Here you can find the source of getNode(Node node, XPathExpression xpath)
public static Node getNode(Node node, XPathExpression xpath)
//package com.java2s; import org.w3c.dom.Node; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; public class Main { public static Node getNode(Node node, XPathExpression xpath) { try {/* w w w. j a va 2s . c o m*/ Object result = xpath.evaluate(node, XPathConstants.NODE); return (Node) result; } catch (XPathExpressionException e) { throw new RuntimeException("Invalid XPath", e); } } }