//创建SAXReader
SAXReader reader = new SAXReader();
Document document = reader.read(new File(path));
//获取文档根节点
Element rootElement = document.getRootElement();
//根据标签名获取标签中的值
String title_value= rootElement.element("title").getTextTrim();
String skill_author = elem.element("personname").getText();
//根据属性获取属性值
String ret_code= elem.attributeValue("role");
//循环获取标签下的子标签(递归调用)
private static void getChildNodes(Element elem){
Iterator<Node> it=elem.nodeIterator();
while (it.hasNext()){
Node node = it.next();
if (node instanceof Element){
Element e1 = (Element)node;
getChildNodes(e1);
}
}
}