books.xml: <?xml version=”1.0″ encoding=”UTF-8″?> <books> <!–This is a test for dom4j, jakoes, 2007.7.19–> <book show=”yes” url=”lucene.net”> <title id=”456″>Lucene Studing</title> </book> <book show=”yes” url=”dom4j.com”> <title id=”123″>Dom4j Tutorials</title> </book> <book show=”no” url=”spring.org”> <title id=”789″>Spring in Action</title> </book> <owner>O’Reilly</owner> </books>
下面我们使用dom4j的xPath来解析:
segment of ParseXML.java:
[...]