Dom4j(解析property)
public class XpathTest {
@Test
public void testXpath() throws DocumentException {
InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("books.xml");
SAXReader saxReader = new SAXReader();
Document document = saxReader.read(resourceAsStream);
Element rootElement = document.getRootElement();
List<Element> selectNodes = rootElement.selectNodes("book");
for (int i = 0; i < selectNodes.size(); i++) {
Element element = selectNodes.get(i);
System.out.println(element);
}
}
}