Here you can find the source of singleXPathNode(String expression, Node node)
public static Node singleXPathNode(String expression, Node node) throws Exception
//package com.java2s; //License from project: Apache License import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Node; public class Main { public static Node singleXPathNode(String expression, Node node) throws Exception { XPath xp = XPathFactory.newInstance().newXPath(); return (Node) xp.evaluate(expression, node, XPathConstants.NODE); }/*www .j av a 2 s .c o m*/ }