<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.7.0" />

XmlDocumentXPathExtensions

public static class XmlDocumentXPathExtensions
Provides extension methods for the XmlDocument and XmlNode for document navigation.
using System.Xml.XPath; namespace System.Xml { public static class XmlDocumentXPathExtensions { private class XmlDocumentNavigable : IXPathNavigable { private XmlNode _node; public XmlDocumentNavigable(XmlNode n) { _node = n; } public XPathNavigator CreateNavigator() { return _node.CreateNavigator(); } } public static XmlNodeList SelectNodes(this XmlNode node, string xpath) { return node.SelectNodes(xpath); } public static XmlNodeList SelectNodes(this XmlNode node, string xpath, XmlNamespaceManager nsmgr) { return node.SelectNodes(xpath, nsmgr); } public static XmlNode SelectSingleNode(this XmlNode node, string xpath) { return node.SelectSingleNode(xpath); } public static XmlNode SelectSingleNode(this XmlNode node, string xpath, XmlNamespaceManager nsmgr) { return node.SelectSingleNode(xpath, nsmgr); } public static XPathNavigator CreateNavigator(this XmlNode node) { return node.CreateNavigator(); } public static IXPathNavigable ToXPathNavigable(this XmlNode node) { return new XmlDocumentNavigable(node); } public static XPathNavigator CreateNavigator(this XmlDocument document) { return document.CreateNavigator(); } public static XPathNavigator CreateNavigator(this XmlDocument document, XmlNode node) { return node.CreateNavigator(); } } }