Package nu.xom

Examples of nu.xom.Document.query()


        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


        Element root = new Element("root");
        Document doc = new Document(root);
        Element child = new Element("pre:child", "http://www.ietf.org");
        root.appendChild(child);
       
        Nodes result = doc.query("/root/*/namespace::*/parent::*");
        assertEquals(1, result.size());
        assertEquals(child, result.get(0));
       
    }
   
View Full Code Here

        Element root = new Element("root");
        Document doc = new Document(root);
        Element child = new Element("pre:child", "http://www.ietf.org");
        root.appendChild(child);
       
        Nodes result = doc.query("/root/*/namespace::*/child::*");
        assertEquals(0, result.size());
       
    }
   

View Full Code Here

        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));
       
        result = doc.query("test[@test1='SUBSCRIBER#']");
        assertEquals(1, result.size());
View Full Code Here

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

        for (int i = 0; i < doc2Queries.size(); i++) {
            Element query = (Element) doc2Queries.get(i);
            String xpath = query.getFirstChildElement("syntax").getValue();
            String id = query.getAttributeValue("id");

            Nodes result = html.query(xpath, context);
            Element answer = query.getFirstChildElement("answer");
            Nodes expected = new Nodes();
            for (int j = 0; j < answer.getChildCount(); j++) {
                Node node = answer.getChild(j);
                if (node instanceof Text) {
View Full Code Here

    public void testPrecedingAxisWithElementName() {
       
        Element root = new Element("Test");
        Document doc = new Document(root);
       
        Nodes result = doc.query("/descendant::*/preceding::x");
        assertEquals(0, result.size());
       
    }
   
   
View Full Code Here

        Element root = new Element("root");
        Document doc = new Document(root);
        DocType doctype = new DocType("root");
        doc.setDocType(doctype);
       
        Nodes result = doc.query("child::node()[1]");
        assertEquals(1, result.size());
        assertEquals(root, result.get(0));
       
    }
   
View Full Code Here

        DocType doctype = new DocType("root");
        doc.setDocType(doctype);
        Comment c = new Comment("test");
        doc.insertChild(c, 0);
       
        Nodes result = doc.query("child::node()[1]");
        assertEquals(1, result.size());
        assertEquals(c, result.get(0));
       
    }
   
View Full Code Here

        Element parent = new Element("Test");
        Element child = new Element("child");
        parent.appendChild(child);
        grandparent.appendChild(parent);
       
        Nodes result = doc.query("descendant::*");
        assertEquals(3, result.size());
        assertEquals(grandparent, result.get(0));  
        assertEquals(parent, result.get(1));
        assertEquals(child, result.get(2));
       
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.