XmlDocument.SelectSingleNodeNS(String, Object) 方法

定義

將指定的模式比對作業套用至這個節點的內容,並傳回第一個相符的節點。

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

參數

xpath
String

Platform::String

winrt::hstring

指定 XPath 運算式。

namespaces
Object

Platform::Object

IInspectable

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

傳回

符合指定模式比對作業的第一個節點。 如果沒有節點符合運算式,這個方法會傳回 Null 值。

實作

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

範例

var input = document.SelectSingleNodeNS("//*[@x:Name='Input']", "xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'");
auto input = document.SelectSingleNodeNS(L"//*[@x:Name='Input']", winrt::box_value(L"xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'"));

備註

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

適用於