Chapter 8. JXPath

JXPath allows you to traverse complex graphs of objects quickly and tersely, using the W3C standard XPath syntax (http://www.w3.org/TR/xpath, and a tutorial is available at http://www.w3schools.com/xpath/). Although XPath was originally designed to provide a standardized mechanism for dealing with complex XML documents, JXPath extends the XPath syntax to support dealing with a wide variety of complex Java data types.

To understand the use of JXPath, start by considering a simple hierarchical structure of people. These people are described by Java objects based on the Person class, as shown in Figure 8-1. Notice that each Person has a gender at a minimum and optionally a mother, father, and children.

Figure 8-1. Person class.

Given ...

Get Apache Jakarta Commons: Reusable Java™ Components 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.