Returns the prefix associated with a given namespace URI.
[Visual Basic] Public Function GetPrefixOfNamespace( _ ByVal ns As String _ ) As String [C#] public string GetPrefixOfNamespace( string ns ); [C++] public: String* GetPrefixOfNamespace( String* ns ); [JScript] public function GetPrefixOfNamespace( ns : String ) : String;
The prefix associated with the given namespace URI, or null if this element and its parent elements do not contain a prefix definition for the namespace.
Exception Type | Condition |
---|---|
ArgumentException | If ns is null. |
This method examines the "xmlns:nnn" attributes of this element and its parent elements to determine the prefix associated with the given namespace URI.
Given an XmlElement with the following text representation:
the GetPrefixOfNamespace method returns the value "abc" when given the argument "urn:abc-schema".
XmlElement Class | XmlElement Members | System.Xml Namespace | GetNamespaceOfPrefix