Package nu.xom

Examples of nu.xom.Nodes


       
        Element parent = new Element("Test");
        parent.appendChild("test");
        parent.appendChild("again");
       
        Nodes result = parent.query("node()[contains(., 'tag')]");
        assertEquals(2, result.size());
        assertEquals("test", result.get(0).getValue());  
        assertEquals("again", result.get(1).getValue());  
       
    }
View Full Code Here


       
        Element parent = new Element("Test");
        parent.appendChild("test");
        parent.appendChild("again");
       
        Nodes result = parent.query("child::text()[1]");
        assertEquals(2, result.size());
        assertEquals("test", result.get(0).getValue());  
        assertEquals("again", result.get(1).getValue());  
       
    }
View Full Code Here

    public void testEmptyTextNodes() {
       
        Element parent = new Element("Test");
        parent.appendChild("");
       
        Nodes result = parent.query("child::text()");
        assertEquals(0, result.size())
       
    }
View Full Code Here

        Element parent = new Element("parent");
        Text empty = new Text("");
        Text nonempty = new Text("value");
        parent.appendChild(nonempty);
        parent.appendChild(empty);
        Nodes result = parent.query("node()");
        assertEquals(2, result.size());
       
    }
View Full Code Here

        Text empty = new Text("");
        Text nonempty = new Text("value");
        parent.appendChild(nonempty);
        parent.appendChild(empty);

        Nodes result2 = parent.query("/*[count(node())=1]");
        assertEquals(1, result2.size());
        assertEquals(parent, result2.get(0));
       
        Nodes nodes1 = parent.query("node()[1]");
        assertEquals(2, nodes1.size());
        Nodes nodes2 = parent.query("node()[2]");
        assertEquals(0, nodes2.size());
       
    }
View Full Code Here

        Text nonempty2 = new Text("value2");
        parent.appendChild(empty);
        parent.appendChild(nonempty);
        parent.appendChild(nonempty2);
       
        Nodes result = parent.query("node()");
        assertEquals(3, result.size());

        Nodes result2 = parent.query("/*[count(node())=1]");
        assertEquals(1, result2.size());
        assertEquals(parent, result2.get(0));
       
        Nodes nodes1 = parent.query("node()[1]");
        assertEquals(3, nodes1.size());
       
        Nodes nodes2 = parent.query("node()[2]");
        assertEquals(0, nodes2.size());
       
    }
View Full Code Here

    public void testNaNEvaluatesToFalse() {
       
        Element root = new Element("root");
        Document doc = new Document(root);
       
        Nodes result = doc.query("/*[boolean(0 div 0)]");
        assertEquals(0, result.size());
       
    }
View Full Code Here

         Element span = new Element("span");
         p.appendChild(span);
         Element div = new Element("div");
         body.appendChild(div);
        
         Nodes result = div.query("preceding::*[1]");
         assertEquals(1, result.size());
         assertEquals(span, result.get(0));
        
     }
View Full Code Here

     
         Element root = new Element("html");
         Document doc = new Document(root);
         root.appendChild("test");
        
         Nodes result = doc.query("/*[string(/) != '']");
         assertEquals(1, result.size());
         assertEquals(root, result.get(0));
        
     }
View Full Code Here

   
     public void testContextPositionForParaentlessNodeIs1() {
     
         Element root = new Element("html");
        
         Nodes result = root.query("self::*[1]");
         assertEquals(1, result.size());
         assertEquals(root, result.get(0));
        
     }
View Full Code Here

TOP

Related Classes of nu.xom.Nodes

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.