Code example for XPath

Methods: evaluate

                        xpath.evaluate(select, contextNode); 
                        fail("Expected exception!"); 
                    } catch (XPathExpressionException expected) { 
        /* a <test> with a nested <valueOf>, both of which have select attributes */ 
        NodeList valueOfElements = element.getElementsByTagName("valueOf"); 
        if (valueOfElements.getLength() == 1) { 
            final Element valueOf = (Element) valueOfElements.item(0); 
            final String valueOfSelect = valueOf.getAttribute("select"); 
            return new XPathTest(context, select) { 
                @Override void test(Node contextNode) throws XPathExpressionException {
                    Node newContext = (Node) xpath.evaluate(
                            select, contextNode, XPathConstants.NODE);
                            xpath.evaluate(valueOfSelect, newContext, XPathConstants.STRING));
Connect your IDE to all the code out there  Get Codota for Java