XPathNavigator.GetNamespace Method (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns the value of the namespace node corresponding to the specified local name.

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

public virtual string GetNamespace(
	string name


Type: System.String

The local name of the namespace node.

Return Value

Type: System.String

A String that contains the value of the namespace node; String.Empty if a matching namespace node is not found, or if the XPathNavigator is not positioned on an element node.

Namespaces xml and xmlns always return a value. If String.Empty is specified as the name parameter, the GetNamespace method returns the default xmlns namespace.

For a definition of namespace nodes, see section 5.4 of the W3C XML Path Language (XPath) recommendation located at http://www.w3.org/TR/xpath#data-model.

This method does not affect the state of the XPathNavigator.

.NET Framework
Available since 1.1
Available since 4.0
Return to top