Here you can find the source of evalXpath(String xpath, Object item)
public static NodeList evalXpath(String xpath, Object item) throws XPathExpressionException
//package com.java2s; //License from project: Open Source License import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.NodeList; public class Main { public static NodeList evalXpath(String xpath, Object item) throws XPathExpressionException { XPath xp = XPathFactory.newInstance().newXPath(); XPathExpression expr = xp.compile(xpath); return (NodeList) expr.evaluate(item, XPathConstants.NODESET); }/*from w w w.j a v a 2 s.c o m*/ }