다음을 통해 공유


IXmlPullParser.Require(XmlPullParserNode, String, String) Method

Definition

Test if the current event is of the given type and if the namespace and name do match.

[Android.Runtime.Register("require", "(ILjava/lang/String;Ljava/lang/String;)V", "GetRequire_ILjava_lang_String_Ljava_lang_String_Handler:Org.XmlPull.V1.IXmlPullParserInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void Require (Org.XmlPull.V1.XmlPullParserNode type, string? namespace, string? name);
[<Android.Runtime.Register("require", "(ILjava/lang/String;Ljava/lang/String;)V", "GetRequire_ILjava_lang_String_Ljava_lang_String_Handler:Org.XmlPull.V1.IXmlPullParserInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member Require : Org.XmlPull.V1.XmlPullParserNode * string * string -> unit

Parameters

namespace
String
name
String
Attributes

Exceptions

Remarks

Test if the current event is of the given type and if the namespace and name do match. null will match any namespace and any name. If the test is not passed, an exception is thrown. The exception text indicates the parser position, the expected event and the current event that is not meeting the requirement.

Essentially it does this

if (type != getEventType()
             || (namespace != null &amp;&amp;  !namespace.equals( getNamespace () ) )
             || (name != null &amp;&amp;  !name.equals( getName() ) ) )
                throw new XmlPullParserException( "expected "+ TYPES[ type ]+getPositionDescription());

Java documentation for org.xmlpull.v1.XmlPullParser.require(int, java.lang.String, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to