Navigating the Document Via XPath in Java

Another important method for navigating XML documents is via XPath. XPath is a non-XML based specification for addressing arbitrary locations in XML Documents. The XPath syntax is described in detail in Chapter 11, “Locating Components in XML Documents with XPath.” A basic usage of XPath with Java is provided in this section.

Unfortunately, a standard interface for XPath is not yet part of the standard Java API for XML provided by Sun. However, a robust implementation available for XPath works seamlessly with implementations of the Java API for XML like Xerces and Xalan. That XPath implementation is called Jaxen (available at http://jaxen.org).

Jaxen is a native Java implementation of the full XPath Specification ...

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.