public static List<String> runXPathQuery(File parsedFile, String xpathExpr) throws Exception{
List<String> result = new ArrayList<String>();
XPath xpath = XPathFactory.newInstance().newXPath();
xpath.setNamespaceContext(getNamespaceContext());
InputSource inputSource = new InputSource(new FileInputStream(parsedFile));
NodeList nodes = (NodeList) xpath.evaluate(xpathExpr, inputSource, XPathConstants.NODESET);
if((nodes != null) && (nodes.getLength() > 0)){
for(int i=0; i<nodes.getLength();i++){
Node node = nodes.item(i);
result.add(node.getNodeValue());
}
}
return result;
}
Utilities.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:incubator-netbeans
作者:
评论列表
文章目录