Java tutorial
//package com.java2s; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import org.w3c.dom.Node; public class Main { public static String findString(Node node, XPathExpression name) throws XPathExpressionException { return (String) name.evaluate(node, XPathConstants.STRING); } }