XmlDocument.SelectNodesNS(String, Object) 方法

定義

將指定的模式比對作業套用至這個節點的內容,並將相符節點的清單傳回為 XmlNodeList

public:
 virtual XmlNodeList ^ SelectNodesNS(Platform::String ^ xpath, Platform::Object ^ namespaces) = SelectNodesNS;
XmlNodeList SelectNodesNS(winrt::hstring const& xpath, IInspectable const& namespaces);
public XmlNodeList SelectNodesNS(string xpath, object namespaces);
function selectNodesNS(xpath, namespaces)
Public Function SelectNodesNS (xpath As String, namespaces As Object) As XmlNodeList

參數

xpath
String

Platform::String

winrt::hstring

指定 XPath 運算式。

namespaces
Object

Platform::Object

IInspectable

包含字串,指定在外部定義新命名空間時,要在 XPath 運算式中使用的命名空間。 命名空間會以 XML 樣式定義,做為命名空間宣告屬性的空間分隔清單。 您也可以使用這個屬性來設定預設命名空間。

傳回

套用指定的模式比對作業來選取的節點集合。 如果未選取任何節點,則會傳回空集合。

實作

M:Windows.Data.Xml.Dom.IXmlNodeSelector.SelectNodesNS(System.String,System.Object) M:Windows.Data.Xml.Dom.IXmlNodeSelector.SelectNodesNS(Platform::String,Platform::Object) M:Windows.Data.Xml.Dom.IXmlNodeSelector.SelectNodesNS(winrt::hstring,IInspectable)

範例

var nodes = document.SelectNodesNS("//mux:TreeView", "xmlns:mux='using:Microsoft.UI.Xaml.Controls'");
auto nodes = document.SelectNodesNS(L"//mux:TreeView", winrt::box_value(L"xmlns:mux='using:Microsoft.UI.Xaml.Controls'"));

備註

查詢中的前置詞會使用指定的命名空間宣告來解析。

適用於