Introduction to the XPathDocument

In the previous sections, you received an overview of the basics of XPath. This section shows you how to use XPath in .NET.

As previously described, the .NET framework presents a set of classes for working with XPath. Serving as a gateway into the .NET Framework's XPath world, the XPathDocument class is similar to the XmlDocument class. However, it doesn't build a tree of XML nodes in memory, but rather processes them one node at a time building XML nodes only when you require them. The main purpose of the XPathDocument class is to perform XPath queries and XSL transformations.

Listing 8.7 presents an example that utilizes the XPathDocument and XPathNavigator classes. The following XML snippet is used by Listing ...

Get Microsoft® Visual C#® .NET 2003 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.