List of utility methods to do XPath Create
List | xPathNodes(String expr, Object context) x Path Nodes return xPathObjects(expr, context);
|
String | xPathSearch(String input, String expression) x Path Search DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); XPath xPath = XPathFactory.newInstance().newXPath(); XPathExpression xPathExpression = xPath.compile(expression); Document document = documentBuilder.parse(new ByteArrayInputStream(input.getBytes("UTF-8"))); return (String) xPathExpression.evaluate(document, XPathConstants.STRING); |