Binding.XPath 屬性

定義

取得或設定 XPath 查詢,這個查詢會傳回要使用的 XML 系結來源上的值。

public:
 property System::String ^ XPath { System::String ^ get(); void set(System::String ^ value); };
public string XPath { get; set; }
member this.XPath : string with get, set
Public Property XPath As String

屬性值

String

XPath 查詢。 預設為 null

備註

當系結來源是 XML 資料,而不是 common Language Runtime (CLR) 物件時, XPath 會使用 屬性,而不是 Path 屬性來指出要使用的系結來源值路徑。

藉由設定 XPath 屬性,您會建立 XPath 查詢來選取節點或節點集合, System.Xml.XmlElement (且 System.Xml.XmlAttribute 兩者都衍生自 System.Xml.XmlNode) 。 System.Xml.XmlNode 是 Common Language Runtime (CLR) 物件,這表示您可以使用 屬性系結至其屬性 Path

方法 XmlNode.SelectNodesXPath 處理 屬性中的 XPath 運算式。 XPath 不支援函式。 如需 XPath 運算式資訊,請參閱 SelectNodes 一節中提供的檔和一些範例。

LINQ to XML 物件 XDocumentXElement 且不使用 XPath 。 如需詳細資訊,請參閱 如何:系結至 XDocument、XElement 或 LINQ for XML 查詢結果

適用於