Export (0) Print
Expand All

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.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft