This documentation is archived and is not being maintained.

XPathNavigator.LookupNamespace Method

Gets the namespace URI for the specified prefix.

Namespace:  System.Xml.XPath
Assembly:  System.Xml (in System.Xml.dll)

public virtual string LookupNamespace(
	string prefix
)

Parameters

prefix
Type: System.String
The prefix whose namespace URI you want to resolve. To match the default namespace, pass String.Empty.

Return Value

Type: System.String
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.

Implements

IXmlNamespaceResolver.LookupNamespace(String)

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.

NoteNote

The prefix to namespace URI mappings can change from node to node in an XML document. As a result, the value of the LookupNamespace method may not be consistent from one node to the next.

For an example of the LookupNamespace method, see the InsertElementAfter or InsertElementBefore methods.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: