Package org.dom4j

Examples of org.dom4j.Element.selectSingleNode()


        final Element root = d.getRootElement();
        assertEquals("project", root.getName());
        assertEquals(1, root.selectNodes("/project/*").size());
        assertEquals(1, root.selectNodes("node").size());
        //weird attr name will be set as attribute subelement
        assertNotNull( root.selectSingleNode("node/attribute"));
        List list = root.selectNodes("node/attribute");
        assertEquals(2, list.size());

        Node attr1 = (Node) list.get(0);
        assertEquals("another:attribute", attr1.selectSingleNode("@name").getStringValue());
View Full Code Here


        final Element root = d.getRootElement();
        assertEquals("project", root.getName());
        assertEquals(1, root.selectNodes("/project/*").size());
        assertEquals(1, root.selectNodes("node").size());
        //weird attr name will be set as attribute subelement
        assertNotNull("expected node/attribute elements", root.selectSingleNode("node/attribute"));
        List list = root.selectNodes("node/attribute");
        assertEquals(2, list.size());

        for (Object o : list) {
            Node attr1 = (Node) list.get(0);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.