Package nu.xom

Examples of nu.xom.Element.addAttribute()


       
        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

   
    public void testAttributeWithUnderscore() {
    
        Element a = new Element("a");
        Attribute foo = new Attribute("_foo", "bar");
        a.addAttribute(foo);
        Nodes results = a.query("//@_foo");
        assertEquals(1, results.size());
        assertEquals(foo, results.get(0));
       
    }
View Full Code Here

       
        Element root = new Element("test");
        Document doc = new Document(root);
        Attribute test = new Attribute("test", "SUBSCRIBER");
        Attribute test1 = new Attribute("test1", "SUBSCRIBER#");
        root.addAttribute(test);
        root.addAttribute(test1);
       
        Nodes result = doc.query("test[@test='SUBSCRIBER']");
        assertEquals(1, result.size());
        assertEquals(root, result.get(0));
View Full Code Here

        Element root = new Element("test");
        Document doc = new Document(root);
        Attribute test = new Attribute("test", "SUBSCRIBER");
        Attribute test1 = new Attribute("test1", "SUBSCRIBER#");
        root.addAttribute(test);
        root.addAttribute(test1);
       
        Nodes result = doc.query("test[@test='SUBSCRIBER']");
        assertEquals(1, result.size());
        assertEquals(root, result.get(0));
       
View Full Code Here

    public void testStartsWith() {
       
        Element parent = new Element("Test");
        Element child = new Element("child");
        child.addAttribute(new Attribute("foo", "bar"));
        parent.appendChild(child);
        Element child2 = new Element("child");
        child2.addAttribute(new Attribute("foo", "big"));
        parent.appendChild(child2);
       
View Full Code Here

        Element parent = new Element("Test");
        Element child = new Element("child");
        child.addAttribute(new Attribute("foo", "bar"));
        parent.appendChild(child);
        Element child2 = new Element("child");
        child2.addAttribute(new Attribute("foo", "big"));
        parent.appendChild(child2);
       
        Nodes result = parent.query(".//*[starts-with(@foo, 'ba')]");
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));
View Full Code Here

    // a jaxen extension function
    public void testEndsWith() {
       
        Element parent = new Element("Test");
        Element child = new Element("child");
        child.addAttribute(new Attribute("foo", "bar"));
        parent.appendChild(child);
       
        try {
            parent.query(".//*[ends-with(@foo, 'ar')]");
            fail("Allowed Jaxen extension function");
View Full Code Here

    public void testXMLLang() {
       
        Element parent = new Element("Test");
        Element child1 = new Element("child");
        child1.addAttribute(new Attribute("xml:lang",
          "http://www.w3.org/XML/1998/namespace", "en"));
        parent.appendChild(child1);
        Element child2 = new Element("child");
        child2.appendChild("2");
        child2.addAttribute(new Attribute("xml:lang",
View Full Code Here

        child1.addAttribute(new Attribute("xml:lang",
          "http://www.w3.org/XML/1998/namespace", "en"));
        parent.appendChild(child1);
        Element child2 = new Element("child");
        child2.appendChild("2");
        child2.addAttribute(new Attribute("xml:lang",
          "http://www.w3.org/XML/1998/namespace", "fr"));
        parent.appendChild(child2);
        Element child3 = new Element("child");
        child3.appendChild("3");
        parent.appendChild(child3);
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.