XmlDocumentXPathExtensions.SelectSingleNode Method

Definition

Overloads

SelectSingleNode(XmlNode, String)

Selects the first node that matches the XPath expression.

SelectSingleNode(XmlNode, String, XmlNamespaceManager)

Selects the first node that matches the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied namespace manager.

SelectSingleNode(XmlNode, String)

Source:
XmlDocumentXPathExtensions.cs

Selects the first node that matches the XPath expression.

C#
public static System.Xml.XmlNode SelectSingleNode(this System.Xml.XmlNode node, string xpath);

Parameters

node
XmlNode

The node where the navigator is initially positioned.

xpath
String

The XPath expression to match.

Returns

The first node that matches the XPath query, or null if no matching node is found.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET Core 1.0, Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

SelectSingleNode(XmlNode, String, XmlNamespaceManager)

Source:
XmlDocumentXPathExtensions.cs

Selects the first node that matches the XPath expression. Any prefixes found in the XPath expression are resolved using the supplied namespace manager.

C#
public static System.Xml.XmlNode SelectSingleNode(this System.Xml.XmlNode node, string xpath, System.Xml.XmlNamespaceManager nsmgr);

Parameters

node
XmlNode

The node where the navigator is initially positioned.

xpath
String

The XPath expression to match.

nsmgr
XmlNamespaceManager

A namespace manager to resolve XPath expression prefix namespaces.

Returns

The first node that matches the XPath query, or null if no matching node is found.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET Core 1.0, Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)