Java XPath Find findNodesByXPath(Node contextNode, String expression)

Here you can find the source of findNodesByXPath(Node contextNode, String expression)

Description

find Nodes By X Path

License

Open Source License

Declaration

public static NodeList findNodesByXPath(Node contextNode, String expression) throws XPathExpressionException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static NodeList findNodesByXPath(Node contextNode, String expression) throws XPathExpressionException {
        return (NodeList) XPathFactory.newInstance().newXPath().evaluate(expression, contextNode,
                XPathConstants.NODESET);
    }// www . j a  va  2s .c o  m
}

Related

  1. findNode(String xPathExpression, Element root)
  2. findNodeByXPath(Node base, String xpath)
  3. findNodeByXpath(String xpathExpression, String fileName)
  4. findNodeByXPath(String xPathString, Object source)
  5. findNodes(final Node node, final String expression)
  6. query(Node context, String query)
  7. querySingle(Node node, String xpathQuery, final String filePath)