Package org.exist.xmldb

Examples of org.exist.xmldb.XPathQueryServiceImpl.query()


        for(final Map.Entry<String, String> mapping : namespaceMappings.entrySet()) {
            service.setNamespace(mapping.getKey(), mapping.getValue());
        }
       
        return (sortBy == null) ? service.query(xpath) : service.query(xpath, sortBy);
    }
   
    /** unused, for testing purposes ?? */
    private void testQuery(final String queryFile) {
        try {
View Full Code Here


        for(final Map.Entry<String, String> mapping : namespaceMappings.entrySet()) {
            service.setNamespace(mapping.getKey(), mapping.getValue());
        }
       
        return (sortBy == null) ? service.query(xpath) : service.query(xpath, sortBy);
    }
   
    /** unused, for testing purposes ?? */
    private void testQuery(final String queryFile) {
        try {
View Full Code Here

   
    XPathQueryServiceImpl service = (XPathQueryServiceImpl)
      col.getService("XPathQueryService", "1.0");
   
//    service.beginProtected();
    ResourceSet result = service.query(xquery);

    System.out.println(Thread.currentThread().getName() + ": found " + result.getSize());
   
    DefaultHandler handler = new DefaultHandler();
    for (int i = 0; i < result.getSize(); i++) {
View Full Code Here

                    return;
                XPathQueryServiceImpl service = (XPathQueryServiceImpl) testCollection
            .getService("XQueryService", "1.0");
        service.beginProtected();
        try {
          ResourceSet result = service.query(query);
          System.out.println("Result: " + result.getSize());
        } finally {
          service.endProtected();
        }
      } catch (Exception e) {
View Full Code Here

        try {
            Collection root = DatabaseManager.getCollection("xmldb:exist:///db/protected", "admin", null);
            XPathQueryServiceImpl service = (XPathQueryServiceImpl) root.getService("XQueryService", "1.0");
            try {
                service.beginProtected();
                ResourceSet result = service.query("collection('/db/protected/test5')//book");
                assertEquals(result.getSize(), DOCUMENT_COUNT);
            } finally {
                service.endProtected();
            }
        } catch (XMLDBException e) {
View Full Code Here

        try {
            Collection root = DatabaseManager.getCollection("xmldb:exist:///db/protected", "admin", null);
            XPathQueryServiceImpl service = (XPathQueryServiceImpl) root.getService("XQueryService", "1.0");
            try {
                service.beginProtected();
                ResourceSet result = service.query("//book");
                assertEquals(result.getSize(), COLLECTION_COUNT * DOCUMENT_COUNT);
            } finally {
                service.endProtected();
            }
        } catch (XMLDBException e) {
View Full Code Here

            Random random = new Random();
            for (int i = 0; i < COLLECTION_COUNT; i++) {
                String docURI = "doc('/db/protected/test" + i + "/xdb" + random.nextInt(DOCUMENT_COUNT) + ".xml')";
                try {
                    service.beginProtected();
                    ResourceSet result = service.query(docURI + "//book");
                    assertEquals(result.getSize(), 1);
                } finally {
                    service.endProtected();
                }
            }
View Full Code Here

        final XPathQueryServiceImpl service2 = (XPathQueryServiceImpl) service;
        service2.declareVariable("name", "MONTAGUE");
        service2.declareVariable("name", "43");

        //ResourceSet result = service.query("//SPEECH[SPEAKER=$name]");
        ResourceSet result = service2.query( doc, "//item[stock=$name]");

        System.out.println("testStaticVariables 1: ========");
        printResult(result);
        result = service2.query("$name");
        assertEquals(1, result.getSize());
View Full Code Here

        //ResourceSet result = service.query("//SPEECH[SPEAKER=$name]");
        ResourceSet result = service2.query( doc, "//item[stock=$name]");

        System.out.println("testStaticVariables 1: ========");
        printResult(result);
        result = service2.query("$name");
        assertEquals(1, result.getSize());

        System.out.println("testStaticVariables 2: ========");
        printResult(result);
        result = service2.query( doc, "//item[stock=43]");
View Full Code Here

        result = service2.query("$name");
        assertEquals(1, result.getSize());

        System.out.println("testStaticVariables 2: ========");
        printResult(result);
        result = service2.query( doc, "//item[stock=43]");
        assertEquals(1, result.getSize());

        System.out.println("testStaticVariables 3: ========");
        printResult(result);
        result = service2.query(doc, "//item");
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.