Using Xpath in Dom4j Using Xpath in Dom4j xml xml

Using Xpath in Dom4j


If you're using mvn2, the following will work with dom4j 1.6.1:

<dependency><groupId>jaxen</groupId><artifactId>jaxen</artifactId><version>1.1.1</version></dependency>

That being said, I hope they fix their pom and save everyone this trouble.


You should add jaxen library to your class path.

EDIT: Actually original dom4j distribution contains jaxen.jar in that as well as all other dependencies.


So xpath works if I include jaxen-1.1-beta-6.jar in addition to the jdom4 jar. Note the jaxen-1.1.1.jar does not work. If you have a classdef error from jdom look at their dependencies and make sure you are using their approved jars, (which for the 1.6.1 version is now often an older release of the jar). Hope this helps anyone with a similar problem. Thanks again for everyone's help!