Chapter 6. Navigating XML with XPath

Once you have an XmlDocument in memory, you could choose to navigate through its nodes by using XmlNodeReader to read each node and do some action if it was of the desired type. Or, you could recursively iterate through its child nodes, interrogating each child node’s node type and name, until you reach the one you’re interested in. Or, you could use XPath.

In this chapter, I’ll introduce the XPath specification, the syntax of XPath expressions, and some of its typical uses. Then I’ll show you the System.Xml.XPath assembly, and how it allows you to use XPath in your .NET applications. Finally, I’ll go through some examples using XPath.

Get .NET & XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.