Jaxen is an open source XPath 1.0 library written in Java. It is adaptable to many different object models, including DOM, XOM, dom4j, and JDOM. Is it also possible to write adapters that treat non-XML trees such as compiled Java byte code or Java beans as XML, thus enabling you to query these trees with XPath too.

The current version is 2.0.0. This release requires Java 1.5 or later. If you're still using Java 1.4, try Jaxen 1.2.0. If you're still using Java 1.3 or earlier, try Jaxen 1.1.6.

Jaxen's Maven group ID is jaxen and its artifact ID is jaxen. To add a dependency on jaxen using Maven, add this dependency element to your pom.xml:

<dependency>
  <groupId>jaxen</groupId>
  <artifactId>jaxen</artifactId>
  <version>2.0.0</version>
</dependency>
To add a dependency using Gradle:
gradle
dependencies {
  compile 'jaxen:jaxen:2.0.0'
}

If you're using any object model other than DOM, you should also add the dependency that supplies a navigator for the model.

Getting Started

You browse the FAQ or the online JavaDoc.

News

XOM 1.3.2 bundles Jaxen 1.2.0.

Sun chose Jaxen for the XPath engine for the JSP Standard Tag Library (JSTL) and the Java Web Services Developer Pack 1.0 and 1.1.

Since the reference implementation of Java API for XML Messaging is based on dom4j and Jaxen, you can use Jaxen to query SOAP messages on the Java platform too!

Check out Elliotte Rusty Harold's book chapter on XPath and Jaxen

Alex Chaffee wrote XPath Explorer to help visualize results of XPath expressions.