Here you can find the source of selectSingleNode(final Node node, final String xPath)
public static Node selectSingleNode(final Node node, final String xPath) throws XPathExpressionException
//package com.java2s; //License from project: Apache License import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Node; public class Main { private static XPathFactory _xpf = XPathFactory.newInstance(); public static Node selectSingleNode(final Node node, final String xPath) throws XPathExpressionException { return (Node) _xpf.newXPath().evaluate(xPath, node, XPathConstants.NODE); }/*from w w w . j a va 2 s. co m*/ }