String xmlpath = ParseXML.class.getResource("peopleInfo.xml").toString();
SAXReader reader = new SAXReader();
Document document = reader.read(xmlpath);
List projects = document.selectNodes("//person/company/name");
Iterator it = projects.iterator();
while (it.hasNext()) {
Element elm = (Element) it.next();
System.out.println(elm.getText());
}
按照指定路径获取xml节点信息
最新推荐文章于 2022-07-06 15:22:32 发布