Package nu.xom

Examples of nu.xom.Attribute


       
        Element parent = new Element("Test");
        Element child1 = new Element("child1");
        Element child2 = new Element("child2");
        Element child3 = new Element("child3");
        Attribute id = new Attribute("a", "anchor");
        id.setType(Attribute.Type.ID);
        child2.addAttribute(id);
       
        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
View Full Code Here


       
        Element parent = new Element("Test");
        Element child1 = new Element("child1");
        Element child2 = new Element("child2");
        Element child3 = new Element("child3");
        Attribute id = new Attribute("id", "anchor");
        child2.addAttribute(id);
       
        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
View Full Code Here

        Element child1 = new Element("child1");
        Element child2 = new Element("child2");
        Element child3 = new Element("child3");
        Text text = new Text("test");
        child3.appendChild(text);
        Attribute id = new Attribute("a", "anchor");
        id.setType(Attribute.Type.ID);
        child2.addAttribute(id);
       
        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
View Full Code Here

        Element parent = new Element("Test", "http://www.example.org");
        Element child = new Element("child", "http://www.example.org");
        parent.appendChild(child);
       
        Element test = new Element("test");
        test.addAttribute(new Attribute("pre:test", "http://www.example.org", "value"));
        XPathContext context = XPathContext.makeNamespaceContext(test);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));  
       
View Full Code Here

        Element parent = new Element("Test", "http://www.example.org");
        Element child = new Element("child", "http://www.example.org");
        parent.appendChild(child);
       
        Element test = new Element("test");
        test.addAttribute(new Attribute("pre:test", "http://www.example.org", "value"));
        Element testChild = new Element("testchild");
        test.appendChild(testChild);
        XPathContext context = XPathContext.makeNamespaceContext(testChild);
        Nodes result = parent.query("child::pre:child", context);
        assertEquals(1, result.size());
View Full Code Here

   
    public void testPrefixedNamespaceQuery() {
       
        Element parent = new Element("a:Test", "http://www.example.org");
        Element child = new Element("b:child", "http://www.example.org");
        Attribute att = new Attribute("c:dog", "http://www.cafeconleche.org/", "test");
        parent.appendChild(child);
        child.addAttribute(att);
       
        XPathContext context = new XPathContext("pre", "http://www.example.org");
        context.addNamespace("c", "http://www.cafeconleche.org/");
View Full Code Here

        String xpath = "(/*/* | /*/*/attribute::*)\n";
        Nodes result = doc.query(xpath);
        assertEquals(4, result.size());
        Element parent = (Element) result.get(0);
        for (int i = 1; i < 4; i++) {
            Attribute attribute = (Attribute) result.get(i);
            assertEquals(parent, attribute.getParent());
        }
       
    }
View Full Code Here

       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        try {
            doc.query("//");
            fail("Queried //");
        }
View Full Code Here

       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        try {
            doc.query("// ");
            fail("Queried // ");
        }
View Full Code Here

       
        Element root = new Element("root", "http://www.example.org");
        Document doc = new Document(root);
        root.appendChild(new Element("child"));
        root.appendChild("test");
        root.addAttribute(new Attribute("test", "test"));
       
        Nodes nodes = doc.query("// a");
        assertEquals(0, nodes.size());
       
    }
View Full Code Here

TOP

Related Classes of nu.xom.Attribute

Copyright © 2018 www.massapicom. 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.