Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
GetNamespace Method

XPathNavigator.GetNamespace Method

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft