Export (0) Print
Expand All

XPathNavigator.ComparePosition Method

Compares the position of the current navigator with the position of the specified XPathNavigator.

[Visual Basic]
Public Overridable Function ComparePosition( _
   ByVal nav As XPathNavigator _
) As XmlNodeOrder
[C#]
public virtual XmlNodeOrder ComparePosition(
 XPathNavigator nav
);
[C++]
public: virtual XmlNodeOrder ComparePosition(
 XPathNavigator* nav
);
[JScript]
public function ComparePosition(
   nav : XPathNavigator
) : XmlNodeOrder;

Parameters

nav
The XPathNavigator to compare against. If this value is a null reference (Nothing in Visual Basic), XmlNodeOrder.Unknown is returned.

Return Value

An XmlNodeOrder value representing the comparative position of the two navigators. The following table describes the XmlNodeOrder enumeration.

XmlNodeOrder Description
Before The current node of this navigator is before the current node of the supplied navigator.
After The current node of this navigator is after the current node of the supplied navigator.
Same The two navigators are positioned on the same node.
Unknown The node positions cannot be determined in document order, relative to each other. This could occur if the two nodes reside in different trees.

Exceptions

Exception Type Condition
 

Remarks

The method behavior is dependent on the node type the XPathNavigator is currently positioned on. When comparing nodes in the XML document, the following rules apply:

  • Element nodes - These nodes are returned in document order from the source document.
  • Namespace nodes - These nodes may be returned in document order and are always before the attribute nodes of the parent element.
  • Attribute nodes - These nodes may be returned in document order. They always come after the namespace nodes and before any child nodes of the parent node.
Note   For more information on the XPath data model and details on each of the node types, see section 5 of the W3C XML Path Language (XPath) recommendation located at http://www.w3.org/TR/xpath#data-model.

This method has no effect on the state of the XPathNavigator.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

XPathNavigator Class | XPathNavigator Members | System.Xml.XPath Namespace | IsSamePosition

Show:
© 2014 Microsoft