public static NodeList evaluateXpathExpression ( Document dom , String xpathExpr ) throws XPathExpressionException { XPathFactory factory = XPathFactory . newInstance ( ) ; XPath xpath = factory . newXPath ( ) ; XPathExpression expr = xpath . compile ( xpathExpr ) ; Object result = expr . evaluate ( dom , XPathConstants . NODESET ) ; return ( NodeList ) result ; }
Returns the list of nodes which match the expression xpathExpr in the Document dom .