Java tutorial
//package com.java2s; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Node; public class Main { static XPath xpath = XPathFactory.newInstance().newXPath(); public static String getValue(Node node, String exprStr) throws XPathExpressionException { XPathExpression expr = xpath.compile(exprStr); return expr.evaluate(node); } }