public static String parseXml ( String xml , String expression ) throws ParserConfigurationException , IOException , XPathExpressionException , SAXException { DocumentBuilder builder = ResourceLoader . getDocumentBuilder ( ) ; Document document ; try { document = builder . parse ( new InputSource ( new StringReader ( xml ) ) ) ; } catch ( SAXException e ) { throw new RuntimeException ( RESPONSE_IS_NOT_WELL_FORMED + xml , e ) ; } XPath xPath = XPathFactory . newInstance ( ) . newXPath ( ) ; return xPath . compile ( expression ) . evaluate ( document ) ; }
Parse the content of the given xml input and evaluates the given XPath expression .