Extensions 類別

定義

這個類別包含可讓您評估 XPath 運算式的 LINQ to XML 擴充方法。

public ref class Extensions abstract sealed
public static class Extensions
type Extensions = class
Public Module Extensions
繼承
Extensions

備註

使用這些方法會有一些效能負面影響。 使用LINQ to XML查詢會產生更好的效能。

雖然 XML XPath Language 1.0 建議未指定傳回集合的順序,但此擴充方法會依檔順序傳回節點。

請注意,即使您使用反向座標軸,例如 preceding-siblingancestor-or-self ,節點還是會依檔順序傳回。

方法

CreateNavigator(XNode)

建立 XPathNavigatorXNode

CreateNavigator(XNode, XmlNameTable)

建立 XPathNavigatorXNodeXmlNameTable 可讓 XPath 運算式處理時更有效率。

XPathEvaluate(XNode, String)

評估 XPath 運算式。

XPathEvaluate(XNode, String, IXmlNamespaceResolver)

評估 XPath 運算式,並使用指定的 IXmlNamespaceResolver 解析命名空間後置字元。

XPathSelectElement(XNode, String)

使用 XPath 運算式選取 XElement

XPathSelectElement(XNode, String, IXmlNamespaceResolver)

使用 XPath 運算式選取 XElement,並使用指定的 IXmlNamespaceResolver 解析命名空間後置字元。

XPathSelectElements(XNode, String)

使用 XPath 運算式選取項目的集合。

XPathSelectElements(XNode, String, IXmlNamespaceResolver)

使用 XPath 運算式選取項目集合,並使用指定的 IXmlNamespaceResolver 解析命名空間後置字元。

適用於