Code example for NamedNodeMap

Methods: getLengthgetNamedItem

0
        assertEquals(1, grandChildren.getLength());
        assertTrue("should be text, is " + grandChildren.item(0).getClass(),
                   grandChildren.item(0) instanceof Text);
        assertEquals("trim me", ((Text) grandChildren.item(0)).getData());
        NamedNodeMap attrs = child.getAttributes();
        assertEquals(2, attrs.getLength());
        Attr a = (Attr) attrs.getNamedItem("attr");
        assertEquals("trim me", a.getValue());
        Attr a2 = (Attr) attrs.getNamedItem("attr2");
        assertEquals("not me", a2.getValue());
    } 
 
    @Test public void stripWhitespaceDoesntAlterOriginal() { 
        handleWsDoesntAlterOriginal(stripWsSetup()); 
    } 
 
    @Test public void normalizeWhitespaceDoesntAlterOriginal() { 
        handleWsDoesntAlterOriginal(normalizeWsSetup()); 
    } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE