Package org.apache.commons.configuration.tree

Examples of org.apache.commons.configuration.tree.ConfigurationNode.addAttribute()


        assertTrue("Found elements with name attribute", context.selectNodes(
                "//" + CHILD_NAME2 + "[@name]").isEmpty());
        ConfigurationNode node = (ConfigurationNode) root.getChild(2).getChild(
                1).getChildren(CHILD_NAME2).get(1);
        node.addAttribute(new DefaultConfigurationNode("name", "testValue"));
        List nodes = context.selectNodes("//" + CHILD_NAME2 + "[@name]");
        assertEquals("Name attribute not found", 1, nodes.size());
        assertEquals("Wrong node returned", node, nodes.get(0));
    }
View Full Code Here


    {
        super.setUp();
       
        // Adds further attributes to the test node
        ConfigurationNode testNode = root.getChild(1);
        testNode.addAttribute(new DefaultConfigurationNode(TEST_ATTR, "yes"));
        pointer = new ConfigurationNodePointer(testNode, Locale.getDefault());
    }

    /**
     * Tests to iterate over all attributes.
View Full Code Here

            for (int i = 1; i <= CHILD_COUNT; i++)
            {
                ConfigurationNode child = new DefaultConfigurationNode(
                        (i % 2 == 0) ? CHILD_NAME1 : CHILD_NAME2, prefix + i);
                parent.addChild(child);
                child.addAttribute(new DefaultConfigurationNode(ATTR_NAME,
                        String.valueOf(i)));

                createLevel(child, level - 1);
            }
        }
View Full Code Here

            for (int i = 1; i <= CHILD_COUNT; i++)
            {
                ConfigurationNode child = new DefaultConfigurationNode(
                        (i % 2 == 0) ? CHILD_NAME1 : CHILD_NAME2, prefix + i);
                parent.addChild(child);
                child.addAttribute(new DefaultConfigurationNode(ATTR_NAME,
                        String.valueOf(i)));

                createLevel(child, level - 1);
            }
        }
View Full Code Here

        assertTrue("Found elements with name attribute", context.selectNodes(
                "//" + CHILD_NAME2 + "[@name]").isEmpty());
        ConfigurationNode node = (ConfigurationNode) root.getChild(2).getChild(
                1).getChildren(CHILD_NAME2).get(1);
        node.addAttribute(new DefaultConfigurationNode("name", "testValue"));
        List nodes = context.selectNodes("//" + CHILD_NAME2 + "[@name]");
        assertEquals("Name attribute not found", 1, nodes.size());
        assertEquals("Wrong node returned", node, nodes.get(0));
    }
View Full Code Here

    {
        super.setUp();
       
        // Adds further attributes to the test node
        ConfigurationNode testNode = root.getChild(1);
        testNode.addAttribute(new DefaultConfigurationNode(TEST_ATTR, "yes"));
        pointer = new ConfigurationNodePointer(testNode, Locale.getDefault());
    }

    /**
     * Tests to iterate over all attributes.
View Full Code Here

        assertTrue("Found elements with name attribute", context.selectNodes(
                "//" + CHILD_NAME2 + "[@name]").isEmpty());
        ConfigurationNode node = root.getChild(2).getChild(
                1).getChildren(CHILD_NAME2).get(1);
        node.addAttribute(new DefaultConfigurationNode("name", "testValue"));
        List<?> nodes = context.selectNodes("//" + CHILD_NAME2 + "[@name]");
        assertEquals("Name attribute not found", 1, nodes.size());
        assertEquals("Wrong node returned", node, nodes.get(0));
    }
View Full Code Here

    {
        super.setUp();

        // Adds further attributes to the test node
        ConfigurationNode testNode = root.getChild(1);
        testNode.addAttribute(new DefaultConfigurationNode(TEST_ATTR, "yes"));
        pointer = new ConfigurationNodePointer(testNode, Locale.getDefault());
    }

    /**
     * Tests to iterate over all attributes.
View Full Code Here

            for (int i = 1; i <= CHILD_COUNT; i++)
            {
                ConfigurationNode child = new DefaultConfigurationNode(
                        (i % 2 == 0) ? CHILD_NAME1 : CHILD_NAME2, prefix + i);
                parent.addChild(child);
                child.addAttribute(new DefaultConfigurationNode(ATTR_NAME,
                        String.valueOf(i)));

                createLevel(child, level - 1);
            }
        }
View Full Code Here

        for (ConfigurationNode child : nodes)
        {
            if (child.isAttribute())
            {
                parent.addAttribute(child);
            }
            else
            {
                parent.addChild(child);
            }
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.