Here you can find the source of extractNodeList(XPath xpath, String nodePath, String xmlString)
public static NodeList extractNodeList(XPath xpath, String nodePath, String xmlString)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import java.io.StringReader; public class Main { public static NodeList extractNodeList(XPath xpath, String nodePath, String xmlString) { InputSource inputSource = new InputSource(new StringReader(xmlString)); try {/*from w ww . j a va 2s .c om*/ return (NodeList) xpath.evaluate(nodePath, inputSource, XPathConstants.NODESET); } catch (XPathExpressionException e) { return null; } } }