/**
*path xml字符串
*ndename 节点名称
*/
public static Node analytic(String path, String nodeName) {
Document doc = null;
try {
doc = DocumentHelper.parseText(path);
} catch (DocumentException e) {
e.printStackTrace();
}
XPath xpathSelector = DocumentHelper.createXPath(nodeName);
Node node = xpathSelector.selectSingleNode(doc);
return node;
}
(2)--------------
Document doc = DocumentHelper.parseText(sbuf); // 将字符串转为XML
Element rootElt = doc.getRootElement(); // 获取根节点
notice.setVersion(rootElt.elementText("Version"));