Package org.dom4j

Examples of org.dom4j.Element.selectSingleNode()


            assertEquals(1, root.selectNodes("/project/*").size());
            assertEquals(1, root.selectNodes("node").size());
            assertEquals("test1name", root.selectSingleNode("node/@name").getStringValue());
            assertEquals("test1", root.selectSingleNode("node/@hostname").getStringValue());
            assertEquals("a, d", root.selectSingleNode("node/@tags").getStringValue());
            assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
View Full Code Here


            assertEquals(1, root.selectNodes("node").size());
            assertEquals("test1name", root.selectSingleNode("node/@name").getStringValue());
            assertEquals("test1", root.selectSingleNode("node/@hostname").getStringValue());
            assertEquals("a, d", root.selectSingleNode("node/@tags").getStringValue());
            assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
        }
View Full Code Here

            assertEquals("test1name", root.selectSingleNode("node/@name").getStringValue());
            assertEquals("test1", root.selectSingleNode("node/@hostname").getStringValue());
            assertEquals("a, d", root.selectSingleNode("node/@tags").getStringValue());
            assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
        }
        assertTrue(test1.delete());
View Full Code Here

            assertEquals("test1", root.selectSingleNode("node/@hostname").getStringValue());
            assertEquals("a, d", root.selectSingleNode("node/@tags").getStringValue());
            assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
        }
        assertTrue(test1.delete());
        {
View Full Code Here

            assertEquals("a, d", root.selectSingleNode("node/@tags").getStringValue());
            assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
        }
        assertTrue(test1.delete());
        {
            //test arbitrary attributes
View Full Code Here

            assertEquals("test desc", root.selectSingleNode("node/@description").getStringValue());
            assertEquals("test arch", root.selectSingleNode("node/@osArch").getStringValue());
            assertEquals("test fam", root.selectSingleNode("node/@osFamily").getStringValue());
            assertEquals("test osname", root.selectSingleNode("node/@osName").getStringValue());
            assertEquals("test vers", root.selectSingleNode("node/@osVersion").getStringValue());
            assertEquals("test user", root.selectSingleNode("node/@username").getStringValue());
        }
        assertTrue(test1.delete());
        {
            //test arbitrary attributes
            final ResourceXMLGenerator gen = new ResourceXMLGenerator(test1);
View Full Code Here

            assertNotNull(d);
            final Element root = d.getRootElement();
            assertEquals("project", root.getName());
            assertEquals(1, root.selectNodes("/project/*").size());
            assertEquals(1, root.selectNodes("node").size());
            assertEquals("myattrvalue", root.selectSingleNode("node/@myattr").getStringValue());
            //weird attr name will be set as attribute subelement
            assertNotNull( root.selectSingleNode("node/attribute"));
            assertEquals(1, root.selectNodes("node/attribute").size());
            assertEquals("-asdf", root.selectSingleNode("node/attribute/@name").getStringValue());
            assertEquals("test value", root.selectSingleNode("node/attribute/@value").getStringValue());
View Full Code Here

            assertEquals("project", root.getName());
            assertEquals(1, root.selectNodes("/project/*").size());
            assertEquals(1, root.selectNodes("node").size());
            assertEquals("myattrvalue", root.selectSingleNode("node/@myattr").getStringValue());
            //weird attr name will be set as attribute subelement
            assertNotNull( root.selectSingleNode("node/attribute"));
            assertEquals(1, root.selectNodes("node/attribute").size());
            assertEquals("-asdf", root.selectSingleNode("node/attribute/@name").getStringValue());
            assertEquals("test value", root.selectSingleNode("node/attribute/@value").getStringValue());
        }
    }
View Full Code Here

            assertEquals(1, root.selectNodes("node").size());
            assertEquals("myattrvalue", root.selectSingleNode("node/@myattr").getStringValue());
            //weird attr name will be set as attribute subelement
            assertNotNull( root.selectSingleNode("node/attribute"));
            assertEquals(1, root.selectNodes("node/attribute").size());
            assertEquals("-asdf", root.selectSingleNode("node/attribute/@name").getStringValue());
            assertEquals("test value", root.selectSingleNode("node/attribute/@value").getStringValue());
        }
    }

View Full Code Here

            assertEquals("myattrvalue", root.selectSingleNode("node/@myattr").getStringValue());
            //weird attr name will be set as attribute subelement
            assertNotNull( root.selectSingleNode("node/attribute"));
            assertEquals(1, root.selectNodes("node/attribute").size());
            assertEquals("-asdf", root.selectSingleNode("node/attribute/@name").getStringValue());
            assertEquals("test value", root.selectSingleNode("node/attribute/@value").getStringValue());
        }
    }


    /**
 
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.