Java tutorial
//package com.java2s; import javax.xml.xpath.XPath; 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 final XPath xPath = XPathFactory.newInstance().newXPath(); public static final String xPathString(final Node aNode, final String anXPath) throws XPathExpressionException { return (String) xPath.compile(anXPath).evaluate(aNode, XPathConstants.STRING); } }