System.Xml.XPath.XPathNavigator.LookupNamespace Method

Gets the namespace URI for the specified prefix.

Syntax

public virtual string LookupNamespace (string prefix)

Parameters

prefix
The prefix whose namespace URI you want to resolve. To match the default namespace, pass string.Empty.

Returns

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

Remarks

If string.Empty is specified as the prefix parameter, the currently assigned default namespace URI is returned. If no default namespace URI is explicitly assigned, and string.Empty is specified as the prefix parameter, the blank prefix is associated with elements that are not in any namespace, and string.Empty is returned.

Note:

The prefix to namespace URI mappings can change from node to node in an XML document. As a result, the value of the XPathNavigator.LookupNamespace(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