Java tutorial
//package com.java2s; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Node; public class Main { public static String eval(Node doc, String xpath_url) throws XPathExpressionException { XPathFactory xpathFactory = XPathFactory.newInstance(); return xpathFactory.newXPath().compile(xpath_url).evaluate(doc); } }