Package org.dom4j

Examples of org.dom4j.Element.selectNodes()


        //assert contents
        final Document d = reader.read(test1);
        assertNotNull(d);
        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());
View Full Code Here


        final Document d = reader.read(test1);
        assertNotNull(d);
        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());

View Full Code Here

        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);
            String name = attr1.selectSingleNode("@name").getStringValue();
View Full Code Here

        throw new RuntimeException("read session config exception");
      }

      Document doc = DocumentHelper.parseText(sessionText);
      Element root=doc.getRootElement();
      List<Node> nodes = root.selectNodes("/cookies/cookie");
      if (nodes != null) {
        Set<String> set = new HashSet<String>();
        for (Node node : nodes) {
          CookieConfig cookieConfig = new CookieConfig();
          Node key = node.selectSingleNode("key");
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.