Share via


Node Set Navigation Using XPathNavigator

You can navigate over nodes in an XPathDocument or XmlDocument object using the node set navigation methods of the XPathNavigator class. You can navigate over all the nodes or over a selected set of nodes returned by one of the selection methods of the XPathNavigator class.

Element Node Set Navigation

The XPathNavigator class provides several methods used to navigate element nodes. The following table shows the navigation methods available and a description of how they move; this does not include methods used to navigate attribute and namespace nodes.

For more information about selecting nodes in an XPathNavigator object, see Selecting, Evaluating and Matching XML Data using XPathNavigator. For more information about navigating attribute and namespace nodes, see Attribute and Namespace Node Navigation Using XPathNavigator.

Method

Description

MoveTo

Moves the XPathNavigator to the same position of the XPathNavigator specified.

MoveToChild

Moves the XPathNavigator to a child node of the current node.

MoveToFirst

Moves the XPathNavigator to the first sibling node of the current node.

MoveToFirstChild

Moves the XPathNavigator to the first child node of the current node.

MoveToFollowing

Moves the XPathNavigator to the specified element in document order.

MoveToId

Moves the XPathNavigator to the node that has an attribute of type ID with a value that matches the given String.

MoveToNext

Moves the XPathNavigator to the next sibling node of the current node.

MoveToParent

Moves the XPathNavigator to the parent node of the current node.

MoveToPrevious

Moves the XPathNavigator to the previous sibling node of the current node.

MoveToRoot

Moves the XPathNavigator to the root node of the XML document.

Comments and Processing Instruction Node Navigation

The following XPathNavigator class methods are valid for moving to comments or processing instructions from other nodes in an XML document.

See Also

Reference

XmlDocument

XPathDocument

XPathNavigator

Concepts

Process XML Data Using the XPath Data Model

Attribute and Namespace Node Navigation Using XPathNavigator

Extract XML Data Using XPathNavigator

Accessing Strongly Typed XML Data Using XPathNavigator