To use Commons JXPath in a Maven 2 project, add the following
dependency to your project's pom.xml
:
Example 12.1. Adding a Dependency on Commons JXPath
<dependency> <groupId>commons-jxpath</groupId> <artifactId>commons-jxpath</artifactId> <version>1.3</version> </dependency>
If you are not sure what this means, I'd suggest reading Maven: The Definitive
Guide. When you depend on a library in Maven 2, all you need to
do is add the dependency groupId
,
artifactId
, and version
to your
project's dependencies. Once you do this, Maven 2 will download the
dependency and make it available on your project's classpath.
Commons JXPath provides a mechanism for evaluating XML Path Language (XPath) expressions against objects and various data structures in Java. This unconventional application of XPath to objects enables a developer to traverse, address, and filter specific nodes or locations in a complex object graph. This chapter details a few of the ways in which JXPath can be used to search, select, and filter objects.
For more information about Commons JXPath, see the Commons JXPath project page at http://commons.apache.org/jxpath. For more information about XPath, see the official W3C XPath recommendation at http://www.w3.org/TR/xpath.