Package nu.xom

Examples of nu.xom.Text


        Element parent = new Element(name, uri);

        Attribute a1 = new Attribute("test", "test");      
        parent.addAttribute(a1);
       
        Node child1 = new Text("http://www.mauve.com");
        parent.appendChild(child1);
        Node child2 = new ProcessingInstruction(
          "child", "http://www.mauve.com");
        parent.appendChild(child2);
        Node child3 = new Comment("http://www.mauve.com");
        parent.appendChild(child3);
 
        assertEquals(parent, child3.getParent());
        assertEquals(parent, child1.getParent());
        assertEquals(parent, child2.getParent());
      
        Nodes result = parent.removeChildren();
        assertEquals(0, parent.getChildCount());
        assertNull(child1.getParent());
        assertNull(child2.getParent());
        assertNull(child3.getParent());
        assertEquals(parent, a1.getParent());
       
        assertEquals(3, result.size());
View Full Code Here


   

    public void testSelfAxisWithTextChild() {
       
        Element parent = new Element("parent");
        Node child = new Text("child");
        parent.appendChild(child);
        Nodes result = child.query("self::text()");
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));
       
    }
View Full Code Here

   

    public void testSelfAxisWithTextChildren() {
       
        Element parent = new Element("parent");
        Node child1 = new Text("1");
        Node child2 = new Text("2");
        Node child3 = new Text("3");
        Node child4 = new Text("4");
        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
        parent.appendChild(child4);
        Nodes result = child1.query("self::text()");
View Full Code Here

   

    public void testSelfAxisWithTextChildren2() {
       
        Element parent = new Element("parent");
        Node child1 = new Text("1");
        Node child2 = new Text("2");
        Node child3 = new Text("3");
        Node child4 = new Text("4");
        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
        parent.appendChild(child4);
        Nodes result = child3.query("self::text()");
View Full Code Here

    }
   

    public void testSelfAxisWithTextChildAndNoParent() {
       
        Node child = new Text("child");
        Nodes result = child.query("self::text()");
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));
       
    }
View Full Code Here

    }
   

    public void testAttributeAxisOnNonElement() {
       
        Text text = new Text("Test");
        Nodes result = text.query("attribute::*");
        assertEquals(0, result.size());
       
    }
View Full Code Here

       
        Element parent = new Element("Test");
        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);
       
        Nodes result = text.query("id('anchor')");
        assertEquals(1, result.size());    
        assertEquals(child2, result.get(0));
       
    }
View Full Code Here

    }
   

    public void testIDFunctionFromUnparentedTextNode() {
       
        Text text = new Text("test");
        Nodes result = text.query("id('anchor')");
        assertEquals(0, result.size());
       
    }
View Full Code Here

    }
   

    public void testIDFunctionFromDisconnectedTextNode() {
       
        Text text = new Text("test");      
        Nodes result = text.query("id('anchor')");
        assertEquals(0, result.size());
       
    }
View Full Code Here

    }
   
   
    public void testNamespaceAxisFromNonElement() {
       
        Text text = new Text("test");
       
        Nodes result = text.query("namespace::*");
        assertEquals(0, result.size());
       
    }
View Full Code Here

TOP

Related Classes of nu.xom.Text

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.