次の方法で共有


INamespaceContext.GetPrefix(String) Method

Definition

Get prefix bound to Namespace URI in the current scope.

[Android.Runtime.Register("getPrefix", "(Ljava/lang/String;)Ljava/lang/String;", "GetGetPrefix_Ljava_lang_String_Handler:Javax.Xml.Namespace.INamespaceContextInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public string? GetPrefix (string? namespaceURI);
[<Android.Runtime.Register("getPrefix", "(Ljava/lang/String;)Ljava/lang/String;", "GetGetPrefix_Ljava_lang_String_Handler:Javax.Xml.Namespace.INamespaceContextInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetPrefix : string -> string

Parameters

namespaceURI
String

URI of Namespace to lookup

Returns

prefix bound to Namespace URI in current context

Attributes

Remarks

Get prefix bound to Namespace URI in the current scope.

To get all prefixes bound to a Namespace URI in the current scope, use #getPrefixes(String namespaceURI).

When requesting a prefix by Namespace URI, the following table describes the returned prefix value for all Namespace URI values:

<table border="2" rules="all" cellpadding="4"> <thead> <tr> <td align="center" colspan="2"> getPrefix(namespaceURI) return value for specified Namespace URIs </td> </tr> <tr> <td>Namespace URI parameter</td> <td>prefix value returned</td> </tr> </thead> <tbody> <tr> <td>&lt;default Namespace URI&gt;</td> <td>XMLConstants.DEFAULT_NS_PREFIX ("") </td> </tr> <tr> <td>bound Namespace URI</td> <td>prefix bound to Namespace URI in the current scope, if multiple prefixes are bound to the Namespace URI in the current scope, a single arbitrary prefix, whose choice is implementation dependent, is returned</td> </tr> <tr> <td>unbound Namespace URI</td> <td>null</td> </tr> <tr> <td>XMLConstants.XML_NS_URI ("http://www.w3.org/XML/1998/namespace")</td> <td>XMLConstants.XML_NS_PREFIX ("xml")</td> </tr> <tr> <td>XMLConstants.XMLNS_ATTRIBUTE_NS_URI ("http://www.w3.org/2000/xmlns/")</td> <td>XMLConstants.XMLNS_ATTRIBUTE ("xmlns")</td> </tr> <tr> <td>null</td> <td>IllegalArgumentException is thrown</td> </tr> </tbody> </table>

Java documentation for javax.xml.namespace.NamespaceContext.getPrefix(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