System.Xml.XPath.XPathNavigator.MoveToNamespace Method

Moves the System.Xml.XPath.XPathNavigator to the namespace node with the specified namespace prefix.

Syntax

public virtual bool MoveToNamespace (string name)

Parameters

name
The namespace prefix of the namespace node.

Returns

true if the System.Xml.XPath.XPathNavigator is successful moving to the specified namespace; false if a matching namespace node was not found, or if the System.Xml.XPath.XPathNavigator is not positioned on an element node. If false, the position of the System.Xml.XPath.XPathNavigator is unchanged.

Remarks

After the System.Xml.XPath.XPathNavigator has been moved to the namespace node, the XPathNavigator.Name property reflects the name of the namespace.

When the System.Xml.XPath.XPathNavigator is positioned on a namespace node, the methods XPathNavigator.MoveToNext, XPathNavigator.MoveToPrevious, and XPathNavigator.MoveToFirst are not applicable. These methods always return false and do not change the position of the System.Xml.XPath.XPathNavigator. Rather, you can call XPathNavigator.MoveToNextNamespace to move to the next namespace node.

After the System.Xml.XPath.XPathNavigator is positioned on a namespace node, you can call XPathNavigator.MoveToParent to move back to the element node.

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.

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0