System.Xml.XPath.XPathNavigator.LookupPrefix Method

Gets the prefix declared for the specified namespace URI.

Syntax

public virtual string LookupPrefix (string namespaceURI)

Parameters

namespaceURI
The namespace URI to resolve for the prefix.

Returns

A string that contains the namespace prefix assigned to the namespace URI specified; otherwise, string.Empty if no prefix is assigned to the namespace URI specified. The string returned is atomized.

Remarks

The XPathNavigator.LookupPrefix(string) method returns the first prefix that matches the namespace URI specified. Multiple prefixes referring to the same namespace URI are not ordered in any particular way, so a particular prefix may not be returned each time when more than one is assigned.

Note:

Namespace URI to prefix mappings can change from node to node in an XML document. As a result, the value of the XPathNavigator.LookupPrefix(string) method may not be consistent from one node to the next.

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0