Here you can find the source of xPath(final Node aNode, final String anXPath, final QName aQName)
@SuppressWarnings("unchecked") public static final <T> T xPath(final Node aNode, final String anXPath, final QName aQName) throws XPathExpressionException
//package com.java2s; //License from project: Open Source License import javax.xml.namespace.QName; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Node; public class Main { private static final XPath xPath = XPathFactory.newInstance().newXPath(); @SuppressWarnings("unchecked") public static final <T> T xPath(final Node aNode, final String anXPath, final QName aQName) throws XPathExpressionException { return (T) xPath.compile(anXPath).evaluate(aNode, aQName); }//from w w w . ja va 2 s . co m }