Export (0) Print
Expand All

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
)

Parameters

node
Type: System.Xml.Linq.XNode

An XNode that can process an XPath query.

nameTable
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.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type XNode. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

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.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5

Community Additions

ADD
Show:
© 2014 Microsoft