private static String xpath ( final String xml , final XPathExpression xpath ) throws ParserConfigurationException , SAXException , IOException , XPathExpressionException { final DocumentBuilder builder = DOCUMENT_BUILDER_FACTORY . newDocumentBuilder ( ) ; final Document doc = builder . parse ( new ByteArrayInputStream ( xml . getBytes ( ) ) ) ; return xpath . evaluate ( doc ) ; }
Extract the desired identifier value from an XML response using XPath