Język

IXmlPullParser.GetNamespace(String) Method

Definition

Returns the URI corresponding to the given prefix, depending on current state of the parser.

[Android.Runtime.Register("getNamespace", "(Ljava/lang/String;)Ljava/lang/String;", "GetGetNamespace_Ljava_lang_String_Handler:Org.XmlPull.V1.IXmlPullParserInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public string? GetNamespace(string? prefix);
[<Android.Runtime.Register("getNamespace", "(Ljava/lang/String;)Ljava/lang/String;", "GetGetNamespace_Ljava_lang_String_Handler:Org.XmlPull.V1.IXmlPullParserInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetNamespace : string -> string

Parameters

prefix
String

The namespace prefix to look up, or null for the default namespace.

Returns

The namespace URI bound to prefix in the current scope, or null if no binding exists.

Attributes

Remarks

Returns the URI corresponding to the given prefix, depending on current state of the parser.

If the prefix was not declared in the current scope, null is returned. The default namespace is included in the namespace table and is available via getNamespace (null).

This method is a convenience method for

for (int i = getNamespaceCount(getDepth ())-1; i >= 0; i--) {
              if (getNamespacePrefix(i).equals( prefix )) {
                return getNamespaceUri(i);
              }
             }
             return null;

<strong>Please note:</strong> parser implementations may provide more efficient lookup, e.g. using a Hashtable. The 'xml' prefix is bound to "http://www.w3.org/XML/1998/namespace", as defined in the Namespaces in XML specification. Analogous, the 'xmlns' prefix is resolved to http://www.w3.org/2000/xmlns/

Java documentation for org.xmlpull.v1.XmlPullParser.getNamespace(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