Extensions.CreateNavigator Method (XNode, XmlNameTable)


Creates an XPathNavigator for an XNode. The XmlNameTable enables more efficient XPath expression processing.

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

public static XPathNavigator CreateNavigator(
	this XNode node,
	XmlNameTable nameTable


Type: System.Xml.Linq.XNode

An XNode that can process an XPath query.

Type: System.Xml.XmlNameTable

A XmlNameTable to be used by XPathNavigator.

Return Value

Type: System.Xml.XPath.XPathNavigator

An XPathNavigator that can process XPath queries.

You cannot edit the XML tree using the XPathNavigator that is returned by this method. The CanEdit property returns false.

You cannot create an XPathNavigator for a XDocumentType node. Document types do not participate in the XPath data model.

Namespace declarations are reported from left to right. In contrast, for XmlDocument namespaces are reported from right to left. This is conformant behavior because namespace declarations are not ordered in the XPath data model.

The method MoveToId is not supported for navigators that are returned by this method.

If you use an XmlNameTable with this method to create the XPathNavigator, you will get better performance when evaluating XPath expressions.

Universal Windows Platform
Available since 10
.NET Framework
Available since 3.5
Available since 4.0
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft