Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
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.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft