List of utility methods to do XPath Evaluate
String | evaluateAsString(String expression, Node node) Evaluates the specified expression on the specified node and returns the result as a String. if (isEmpty(node)) return null; String s = evaluateXPath(node, expression); if (s == null) { return null; } else { return s.trim(); |
List | evaluateNodeListTextXPath(final Document document, final String expression) evaluate Node List Text X Path return evaluateNodeListTextXPath(document, compile(expression));
|
List | evaluateNodeListXPath(final Document document, final String expression) evaluate Node List X Path return evaluateNodeListXPath(document, compile(expression));
|
NodeList | evaluateNodes(final XPathExpression xpathExpression, final Document pom) evaluate Nodes try { return (NodeList) xpathExpression.evaluate(pom, XPathConstants.NODESET); } catch (final Exception e) { throw new IllegalStateException(e.getMessage(), e); |
NodeList | evaluateNodeSet(XPathExpression xpe, Object item) Evaluates the given XPath expression in the context of the given item, with the expectation of a node set result. return (NodeList) xpe.evaluate(item, XPathConstants.NODESET);
|
Object | evaluateXpath(Document doc, String xpath, QName returnType) evaluate Xpath XPath path = xpf.newXPath();
return path.evaluate(xpath, doc, returnType);
|
NodeList | evaluateXPath(Element element, String xpathstring) Purpose: Evaluates an XPath and returns the Node list associated witht the XPath XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
XPathExpression expr = xpath.compile(xpathstring);
NodeList result = (NodeList) expr.evaluate(element, XPathConstants.NODESET);
return result;
|
NodeList | evaluateXpath(Element from, String xpath) Evaluates an Xpath expression and return its result as a NodeList. XPathExpression ex = XPathFactory.newInstance().newXPath().compile(xpath);
return (NodeList) ex.evaluate(from, XPathConstants.NODESET);
|
Object | evaluateXPath(final String xPath, final Object item, final QName returnType) Evaluates the xpath on an object XPath xpath = XPathFactory.newInstance().newXPath();
XPathExpression expr = xpath.compile(xPath);
return expr.evaluate(item, returnType);
|
Object | evaluateXPath(final XPathExpression expr, final Object rootNode, final QName returnType) evaluate X Path try { return expr.evaluate(rootNode, returnType); } catch (XPathExpressionException e) { throw new IllegalStateException("Error while evaluating xpath expression " + expr, e); |