Summary

XPath is a straightforward declarative language for selecting particular subsets of nodes from an XML document. Its data model is not quite the same as DOM's data model, but that's not normally a major problem. In fact, in some cases, such as taking the string value of an element, the XPath data model is likely to be a lot closer to what you want than the DOM data model.

XPath location paths are composed of one or more location steps. Each location step has an axis and a node test, and may have one or more predicates. Each location step is evaluated with respect to the context nodes determined by the previous step in the path. The axis determines the direction in which you move from the context node. The node test determines which nodes ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX 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.