Java tutorial
//package com.java2s; import javax.xml.soap.Node; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import org.w3c.dom.Document; public class Main { public static Node readNodeValFromXmlDocument(Document xmlDocument, String xpathQueryExpression, XPath xpathInstance) throws XPathExpressionException { return (Node) xpathInstance.compile(xpathQueryExpression).evaluate(xmlDocument, XPathConstants.NODE); } }