XmlReader reader = XmlReader.Create("books.xml"); XPathDocument doc = new XPathDocument(reader); XPathNavigator nav = doc.CreateNavigator();
XmlDocument doc = new XmlDocument(); doc.Load("books.xml"); XPathNavigator nav = doc.CreateNavigator();This example creates an XPathNavigator object from an XmlDocument object that has loaded the "books.xml" file. The XPathNavigator can then be used to navigate and query the XML document. The System.Xml.XPath namespace provides a set of classes for processing XML documents using XPath expressions. This package is included in the .NET Framework Class Library, which is part of the Microsoft .NET Framework.