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