在jdom中使用xpath,我通常用下面的方式:
Element childNode = (Element) XPath.selectSingleNode(doc.getRootElement(), "/Config/Child/ChildNode[@name = 'A']");
和
List childNodes = XPath.selectNodes(doc.getRootElement(), "/Config/Child/ChildNode");当然了,得捕获JDOMException
Element childNode = (Element) XPath.selectSingleNode(doc.getRootElement(), "/Config/Child/ChildNode[@name = 'A']");
和
List childNodes = XPath.selectNodes(doc.getRootElement(), "/Config/Child/ChildNode");当然了,得捕获JDOMException
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货