Package nu.xom

Examples of nu.xom.Document.query()


        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


                // XPath expressions
                if (queryUsesVars(contextElement)) continue;
               
                String xpath = contextElement.getAttributeValue("select");
                XPathContext namespaces = getXPathContext(contextElement);
                Node context = source.query(xpath).get(0);
               
                // process counts
                Elements tests = contextElement.getChildElements("test");
                for (int k = 0; k < tests.size(); k++) {
                    Element test = tests.get(k);
View Full Code Here

        name.appendChild("a");
        item.appendChild(name);
        Element value = new Element("value");
        value.appendChild("b");
        item.appendChild(value);
        Nodes result = doc.query("/item[name/text()='a']/value");
        assertEquals(1, result.size());
        assertEquals("b", result.get(0).getValue());
       
    }
View Full Code Here

    public void testSimpleTextChildInPredicate() {
       
        Element item = new Element("item");
        Document doc = new Document(item);
        item.appendChild("a");
        Nodes result = doc.query("/item[text()='a']");
        assertEquals(1, result.size());
       
    }
   
   
View Full Code Here

    }
   
    public void testAllNodesQuery() {
       
        Document doc = new Document(new Element("doc"));
        Nodes subset = doc.query("//. | /");
        assertEquals(2, subset.size());
       
    }
   
   
View Full Code Here

        Element b = new Element("b");
        b.appendChild(x2);
        b.appendChild(x3);
        a.appendChild(b);
        a.appendChild(x4);
        Nodes result = doc.query("//x");
        assertEquals(4, result.size());
        assertTrue(result.get(0) instanceof Element);
        assertTrue(result.get(1) instanceof Element);
        assertTrue(result.get(2) instanceof Element);
        assertTrue(result.get(3) instanceof Element);
View Full Code Here

    public void testLongs() {
       
        Document doc = new Document(new Element("root"));
       
        Nodes result = doc.query("/*[5000000000=5000000000]");
        assertEquals(1, result.size());
       
        result = doc.query("/*[5000000000 < 5000000001]");
        assertEquals(1, result.size());
        result = doc.query("/*[5000000000 > 5000000001]");
View Full Code Here

        Document doc = new Document(new Element("root"));
       
        Nodes result = doc.query("/*[5000000000=5000000000]");
        assertEquals(1, result.size());
       
        result = doc.query("/*[5000000000 < 5000000001]");
        assertEquals(1, result.size());
        result = doc.query("/*[5000000000 > 5000000001]");
        assertEquals(0, result.size());
        result = doc.query("/*[5000000001 >= 5000000001]");
        assertEquals(1, result.size());
View Full Code Here

        Nodes result = doc.query("/*[5000000000=5000000000]");
        assertEquals(1, result.size());
       
        result = doc.query("/*[5000000000 < 5000000001]");
        assertEquals(1, result.size());
        result = doc.query("/*[5000000000 > 5000000001]");
        assertEquals(0, result.size());
        result = doc.query("/*[5000000001 >= 5000000001]");
        assertEquals(1, result.size());
        result = doc.query("/*[5000000001 > 5000000001]");
        assertEquals(0, result.size());
View Full Code Here

       
        result = doc.query("/*[5000000000 < 5000000001]");
        assertEquals(1, result.size());
        result = doc.query("/*[5000000000 > 5000000001]");
        assertEquals(0, result.size());
        result = doc.query("/*[5000000001 >= 5000000001]");
        assertEquals(1, result.size());
        result = doc.query("/*[5000000001 > 5000000001]");
        assertEquals(0, result.size());
       
    }
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.