public void TestAttributes()
        {
            InputNode           root  = NodeBuilder.read(new StringReader(SOURCE));
            InputNode           child = root.getNext();
            NodeMap <InputNode> map   = child.getAttributes();

            AssertEquals(root.getReference(), "default");
            AssertEquals(child.getReference(), "default");
            AssertEquals(map.get("attributeA").getValue(), "valueA");
            AssertEquals(map.get("attributeA").getPrefix(), "a");
            AssertEquals(map.get("attributeA").getReference(), "A");
            AssertEquals(map.get("attributeB").getValue(), "valueB");
            AssertEquals(map.get("attributeB").getPrefix(), "b");
            AssertEquals(map.get("attributeB").getReference(), "B");
            InputNode leaf = child.getNext();

            AssertEquals(leaf.getReference(), "default");
            AssertEquals(leaf.getAttribute("attributeC").getValue(), "c");
            AssertEquals(leaf.getAttribute("attributeC").getPrefix(), "b");
            AssertEquals(leaf.getAttribute("attributeC").getReference(), "B");
            InputNode entry = root.getNext();

            AssertEquals(entry.getReference(), "A");
            AssertEquals(entry.getAttribute("attributeD").getValue(), "valueD");
            AssertEquals(entry.getAttribute("attributeD").getPrefix(), "b");
            AssertEquals(entry.getAttribute("attributeD").getReference(), "B");
        }
Example #2
0
        /// <summary>
        /// This is used to write the attributes of the specified node to
        /// the output. This will iterate over each node entered on to
        /// the node. Once written the node is considered inactive.
        /// </summary>
        /// <param name="node">
        /// this is the node to have is attributes written
        /// </param>
        public void WriteAttributes(OutputNode node)
        {
            NodeMap <OutputNode> map = node.getAttributes();

            for (String name : map)
            {
                OutputNode entry  = map.get(name);
                String     value  = entry.getValue();
                String     prefix = entry.getPrefix(verbose);
                writer.WriteAttribute(name, value, prefix);
            }
            active.Remove(node);
        }
Example #3
0
        public void TestInputNode()
        {
            StringReader        reader = new StringReader(SOURCE);
            InputNode           node   = NodeBuilder.read(reader);
            NodeMap <InputNode> map    = node.getAttributes();
            InputNode           attr   = map.get("name");

            AssertEquals("value", attr.getValue());
            AssertEquals("a", attr.getPrefix());
            AssertEquals("http://www.domain.com/a", attr.getReference());
            InputNode child = node.getNext();

            AssertEquals("this is the child", child.getValue());
            AssertEquals("a", child.getPrefix());
            AssertEquals("http://www.domain.com/a", child.getReference());
        }