What Is XPath?

XPath is a language intended to be used with XML documents in order to allow addressing of selected parts of an XML document. This allows some desired process to be carried out on that selected data—perhaps some form of data retrieval or manipulation.

One of the major advantages of XPath is that we simply declare the part of the document that we want to select. We don't have to spell out step-by-step in lengthy code how a processor does the work of locating and navigating to the desired node. The XPath processor does that work for us.

XPath is not written in XML. It more resembles the kind of path information that your operating system might show you or that you frequently see within URLs. One reason XPath is not written in XML ...

Get Special Edition Using XML, Second Edition 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.