Here you can find the source of findNodesByXPath(Node contextNode, String expression)
public static NodeList findNodesByXPath(Node contextNode, String expression) throws XPathExpressionException
//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 }