Examples of XMLResource


Examples of org.xmldb.api.modules.XMLResource

        String query = "//person[first='John' and last='Smith']";

        ResourceSet resultSet = xpathservice.query(query);
        assertEquals(1, resultSet.getSize());

        XMLResource resource = (XMLResource) resultSet.getResource(0);

        String john
                = "<?xml version=\"1.0\"?>"
                + "<person xmlns:src='http://xml.apache.org/xindice/Query' src:col='/db/testing/current' src:key='doc1'>"
                +   "<!-- John Smith -->"
                +   "<first>John</first>"
                +   "<last>Smith</last>"
                +   "<age>30</age>"
                +   "<phone type=\"work\">555-345-6789</phone>"
                + "</person>";

        // ensure that the resource has the correct doc id.
        assertEquals("doc1", resource.getDocumentId());

        XMLAssert.assertXMLEqual(john, TextWriter.toString(resource.getContentAsDOM()));
    }
View Full Code Here

Examples of org.xmldb.api.modules.XMLResource

        xpathservice.setNamespace("h", "http://example.net/person");

        ResourceSet resultSet = xpathservice.query(query);
        assertEquals(1, resultSet.getSize());

        XMLResource resource = (XMLResource) resultSet.getResource(0);

        // ensure that the resource has the correct doc id.
        assertEquals("doc3", resource.getDocumentId());

        Node node = resource.getContentAsDOM();

        // add source node information to the compared xml as it's added by
        // the query processor.
        XMLAssert.assertXMLEqual("<first xmlns:src='http://xml.apache.org/xindice/Query' src:col='/db/testing/current' src:key='doc3' xmlns='http://example.net/person'>Sally</first>",
                                 TextWriter.toString(node));
View Full Code Here

Examples of org.xmldb.api.modules.XMLResource

        xpathservice.setNamespace("h", "http://example.net/person");

        ResourceSet resultSet = xpathservice.query(query);
        assertEquals(1, resultSet.getSize());

        XMLResource resource = (XMLResource) resultSet.getResource(0);
        Node node = resource.getContentAsDOM();
        String retrieved = TextWriter.toString(node);
        assertFalse("Namespace definitions imported deep in: " + retrieved, -1 == retrieved.indexOf("<p:first>"));

        // ensure that the resource has the correct doc id.
        assertEquals("doc3", resource.getDocumentId());

        // add source node information to the compared xml as it's added by
        // the query processor. Note, this should work using without the
        // prefixes in the control document using the default namespace,
        // (i.e. xmlns='http://example.net/person') but I couldn't get it to work
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.