Code example for Element

Methods: getTextContent

0
                    } 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);
                    assertEquals(valueOf.getTextContent(), 
                            xpath.evaluate(valueOfSelect, newContext, XPathConstants.STRING));
                } 
            }; 
        }