日期:2014-05-20 浏览次数:20709 次
String fileName = "e:\\temp\\test.xml";
String nodeName ="/Workbook/Worksheet";//获得Worksheet元素
Document document = new SAXReader().read(new File(fileName));
System.out.println("document name="+document.getName());
List nodes = document.selectNodes(nodeName);
System.out.println("nodes size="+nodes.size());
System.out.println("nodes[0]="+nodes.get(0));
<?xml version="1.0" encoding="UTF-8"?>
<classes name="网络">
<student name="张三">
张三是个好学生
</student>
<student name="李四">
李四也是个好学生
</student>
</classes>