Examples of Nodes


Examples of nu.xom.Nodes

        Attribute a3 = new Attribute("a3", "value");
        child2.addAttribute(a1);
        child2.addAttribute(a2);
        child2.addAttribute(a3);
       
        Nodes result = a2.query("preceding-sibling::node()");
        assertEquals(0, result.size());  
        result = a2.query("following-sibling::node()");
        assertEquals(0, result.size());   
       
    }
View Full Code Here

Examples of nu.xom.Nodes

       
        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
       
        Nodes result = parent.query("id('anchor')");
        assertEquals(1, result.size());    
        assertEquals(child2, result.get(0));
       
    }
View Full Code Here

Examples of nu.xom.Nodes

        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
        Document doc = new Document(parent);
       
        Nodes result = doc.query("id('anchor')");
        assertEquals(1, result.size());    
        assertEquals(child2, result.get(0));
       
    }
View Full Code Here

Examples of nu.xom.Nodes

       
        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
       
        Nodes result = parent.query("id('anchor')");
        assertEquals(0, result.size());
       
    }
View Full Code Here

Examples of nu.xom.Nodes

       
        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

Examples of nu.xom.Nodes

   

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

Examples of nu.xom.Nodes

   

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

Examples of nu.xom.Nodes

        Element child3 = new Element("child3");
        parent.appendChild(child1);
        parent.appendChild(child2);
        parent.appendChild(child3);
       
        Nodes result = child3.query("following-sibling::*");
        assertEquals(0, result.size());  
        result = child2.query("following-sibling::*");
        assertEquals(1, result.size());  
        assertEquals(child3, result.get(0));  
        result = child1.query("following-sibling::*");
        assertEquals(2, result.size());   
       
    }
View Full Code Here

Examples of nu.xom.Nodes

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

Examples of nu.xom.Nodes

   
    public void testNamespaceAxis() {
       
        Element parent = new Element("Test", "http://www.example.org");
       
        Nodes result = parent.query("namespace::*");
        assertEquals(2, result.size());
        Namespace n1 = (Namespace) result.get(0);
        Namespace n2 = (Namespace) result.get(1);
        assertTrue(n1.getPrefix().equals("") || n2.getPrefix().equals(""));
        assertTrue(n1.getPrefix().equals("xml") || n2.getPrefix().equals("xml"));
        assertTrue(n1.getValue().equals("http://www.example.org")
          || n2.getValue().equals("http://www.example.org"));
        assertTrue(n1.getValue().equals(Namespace.XML_NAMESPACE)
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.