Extensions::CreateNavigator Method (XNode^, XmlNameTable^)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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)

static XPathNavigator^ CreateNavigator(
	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.

.NET Framework
Available since 3.5
Available since 4.0
Return to top