Package org.xmldb.api.base

Examples of org.xmldb.api.base.CompiledExpression


        collection.storeResource(res);
        collection.close();
    }

    private ResourceSet executeQuery(String query) throws XMLDBException {
        CompiledExpression compiledQuery = xqService.compile(query);
        ResourceSet result = xqService.execute(compiledQuery);
        return result;
    }
View Full Code Here


        String cols[] = {"one", "two", "three"};

        xqService.setNamespace("itg-modules", "http://localhost:80/itg/xquery");

        CompiledExpression compiledQuery = xqService.compile(query);
        for (int i = 0; i < cols.length; i++) {
            xqService.declareVariable("itg-modules:coll", cols[i]);
            ResourceSet result = xqService.execute(compiledQuery);
            System.out.println("Result: " + result.getResource(0).getContent());
        }
View Full Code Here

        writeModule(testHome, "module1.xqy", module1_module);
        writeModule(testHome, "processor.xqy", processor_module);
        writeModule(testHome, "impl.xqy", impl_module);
        writeModule(testHome, "controller.xqy", controller_module);
       
        CompiledExpression query = xqService.compile(index_module);
        xqService.execute(query);
    }
View Full Code Here

            "};";

        Collection testHome = createCollection("testLocalVariableDeclaration");
        writeModule(testHome, "module1.xqm", module1_module);

        CompiledExpression query = xqService.compile(index_module);
        xqService.execute(query);
    }
View Full Code Here

        final String query1 =
                "xquery version \"1.0\";" +
                "import module namespace processor = \"http://processor\" at \"xmldb:exist://" + testHome.getName() + "/processor.xqm\";" +
                "\tprocessor:execute-module-function(xs:anyURI('http://moda'), xs:anyURI('" + testHome.getName() + "/module1.xqm'), 'hello')";
       
        final CompiledExpression xq1 = xqService.compile(query1);
        final ResourceSet rs1 = xqService.execute(xq1);
       
        assertEquals(1, rs1.getSize());
        Resource r1 = rs1.getIterator().nextResource();
        assertEquals("<hello-from>module1</hello-from>", (String)r1.getContent());
       
        final String query2 =
                "xquery version \"1.0\";" +
                "import module namespace processor = \"http://processor\" at \"xmldb:exist://" + testHome.getName() + "/processor.xqm\";" +
                "\tprocessor:execute-module-function(xs:anyURI('http://moda'), xs:anyURI('" + testHome.getName() + "/module2.xqm'), 'hello')";
       
       
        final CompiledExpression xq2 = xqService.compile(query2);
        final ResourceSet rs2 = xqService.execute(xq2);
       
        assertEquals(1, rs2.getSize());
        Resource r2 = rs2.getIterator().nextResource();
        assertEquals("<hello-from>module2</hello-from>", (String)r2.getContent());
View Full Code Here

           
            // set pretty-printing on
            service.setProperty( OutputKeys.INDENT, "yes" );
            service.setProperty( OutputKeys.ENCODING, "UTF-8" );
           
            CompiledExpression compiled = service.compile( query );
           
            long start = System.currentTimeMillis();
           
            // execute query and get results in ResourceSet
            ResourceSet result = service.execute( compiled );
View Full Code Here

        collection.close();
    }

    protected static ResourceSet executeQuery(String query) throws XMLDBException {
        LOG.info("Executing " + query);
        CompiledExpression compiledQuery = xqService.compile(query);
        ResourceSet result = xqService.execute(compiledQuery);
        return result;
    }
View Full Code Here

    query.append("$doc := xdb:store(\"" + eXistUrl + XmldbURI.ROOT_COLLECTION + "\", $document, $data)");
    query.append("return <result/>");
    try {
      service.declareVariable("document", document);
      service.declareVariable("data", xml);
      CompiledExpression cQuery = service.compile(query.toString());
      service.execute(cQuery);
    } catch (XMLDBException e) {
      fail(e.getMessage());
    }     
  }
View Full Code Here

    query.append("    return\n");
    query.append("                  ()\n");
   
    try {
      service.declareVariable("collection", XmldbURI.ROOT_COLLECTION);
      CompiledExpression cQuery = service.compile(query.toString());
      service.execute(cQuery);
    } catch (XMLDBException e) {
      fail(e.getMessage());
    }     
  }
View Full Code Here

    query.append("let $isLoggedIn := xdb:login('" + eXistUrl + XmldbURI.ROOT_COLLECTION + "', \"admin\", \"admin\"),");
    query.append("$mods := xdb:remove(\"" + eXistUrl + XmldbURI.ROOT_COLLECTION + "\", \"" + doc + "\")");
    query.append("return <modifications>{$mods}</modifications>");

    try {
      CompiledExpression cQuery = service.compile(query.toString());
      service.execute(cQuery);
    } catch (XMLDBException e) {
      fail(e.getMessage());
    }     
  }
View Full Code Here

TOP

Related Classes of org.xmldb.api.base.CompiledExpression

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.