Util.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
public static List runXPathQuery(File parsedFile, String xpathExpr) throws Exception{
    List result = new ArrayList();
    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++){
            org.w3c.dom.Node node = nodes.item(i);
            result.add(node.getNodeValue());
        }
    }
    return result;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号