When parsing XML using DOM4J, it is a good idea to get the data for a node quickly, and Dom4j's quick manual also suggests that
In this way,
method is to use the selectnodes (String XPath) method of document.
selectSingleNode (String XPath)
Code notation:
list<?> list = Document.selectnodes ("//books/book");
The following exception was thrown when executing:
Exception in thread "main" java.lang.noclassdeffounderror:org/jaxen/jaxenexception
At Org.dom4j.DocumentFactory.createXPath (documentfactory.java:230)
At Org.dom4j.tree.AbstractNode.createXPath (abstractnode.java:207)
At Org.dom4j.tree.AbstractNode.selectNodes (abstractnode.java:164)
How can such a good way to throw an exception, trace the past to see, unexpectedly is "List L = doc.selectnodes ("//cols/col1 ");
This error, check a bit to know, not only to have dom4j this bag, but also to have jaxen bag: <jaxen-1.1-beta-6.jar>
It should be DOM4J's base package, which can be found in the Lib directory of the dom4j Zip package. Even with this method, the following two packages are required:
Dom4j-1.6.1.jar
Jaxen-1.1.jar
Parsing XML report ClassNotFound errors