code: public static NodeList string2NodeList(String inputXMLString,
                                             String xPath) throws ParserConfigurationException,
              IOException, XPathExpressionException, SAXException {
          Document doc = XmlDocumentReader.parse(inputXMLString, false); //string2Doc(inputXMLString, false);
          XPathFactory factory = XPathFactory.newInstance();
          XPath xpath = factory.newXPath();
          //compile XML tag extractor sent as param
          XPathExpression expr = xpath.compile(xPath);
  
          Object result = expr.evaluate(doc, XPathConstants.NODESET);
          return (NodeList) result;
      }
docs: Helper program: Extracts the specified XPATH expression
  from an XML-String.
  
  @param inputXMLString the input xml string
  @param xPath          the x path
  @return NodeList
  @throws ParserConfigurationException the parser configuration exception
  @throws IOException                  Signals that an I/O exception has occurred.
  @throws XPathExpressionException     the x path expression exception