Package org.exist.xmldb

Examples of org.exist.xmldb.XQueryService.execute()


                } else {
                    log( "XQuery string: " + query, Project.MSG_DEBUG );
                    source = new StringSource( query );
                }

                results = service.execute( source );
                log( "Found " + results.getSize() + " results", Project.MSG_INFO );

                if( ( destDir != null ) && ( results != null ) ) {
                    log( "write results to directory " + destDir.getAbsolutePath(), Project.MSG_INFO );
                    final ResourceIterator iter = results.getIterator();
View Full Code Here


  public static ResourceSet xquery(Collection collection, String xquery)
  throws XMLDBException
  {
    XQueryService service = getXQueryService(collection);
    Source source = new StringSource(xquery);
    return service.execute(source);
  }
 
  public static XPathQueryService getQueryService(Collection collection)
  throws XMLDBException
  {
View Full Code Here

            if(!((CollectionImpl)collection).isRemoteCollection()) {
                service.declareVariable(RequestModule.PREFIX + ":request", new HttpRequestWrapper(request, "UTF-8", "UTF-8"));
                service.declareVariable(ResponseModule.PREFIX + ":response", new HttpResponseWrapper(response));
                service.declareVariable(SessionModule.PREFIX + ":session", new HttpSessionWrapper(request.getSession( false )));
            }
            final ResourceSet result = service.execute(source);

            String redirectTo = null;
            String servletName = null;
            String path = null;
            RequestWrapper modifiedRequest = null;
View Full Code Here

            StringBuilder fails = new StringBuilder();
            StringBuilder results = new StringBuilder();
            XQueryService xqs = (XQueryService) rootCollection.getService("XQueryService", "1.0");
            Source query = new StringSource(script);

            ResourceSet result = xqs.execute(query);
            XMLResource resource = (XMLResource) result.getResource(0);
            results.append(resource.getContent()).append('\n');
            Element root = (Element) resource.getContentAsDOM();
            NodeList tests = root.getElementsByTagName("result");
            for (int i = 0; i < tests.getLength(); i++) {
View Full Code Here

                        log("Storing " + files[i] + " ...\n");
                        byte[] data = read(file);
                        try {
                            service.declareVariable("name", file.getName());
                            service.declareVariable("data", data);
                            service.execute(source);
                        } catch (XMLDBException e) {
                            String msg="XMLDB exception caught: " + e.getMessage();
                            if(failonerror)
                                throw new BuildException(msg,e);
                            else
View Full Code Here

            service.declareVariable("collection", root.getName());
            service.declareVariable("uri", "");
            if (moduleURI != null) {
                service.declareVariable("uri", moduleURI);
                service.declareVariable("data", "");
                service.execute(source);
            } else {
                for(FileSet fileSet: fileSets) {
                    DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
                    scanner.scan();
                    String[] files = scanner.getIncludedFiles();
View Full Code Here

    try {
      XQueryService xqs = (XQueryService) testCollection.getService("XQueryService", "1.0");
      Source query = new FileSource(new File(TEST_QUERY), "UTF-8", false);
      for (File file : files) {
        xqs.declareVariable("doc", file.getName());
        ResourceSet result = xqs.execute(query);
        XMLResource resource = (XMLResource) result.getResource(0);
                System.out.println(resource.getContent());
        Element root = (Element) resource.getContentAsDOM();
        NodeList tests = root.getElementsByTagName("test");
        for (int i = 0; i < tests.getLength(); i++) {
View Full Code Here

          xqs.declareVariable("id", id);
        } else {
          xqs.declareVariable("id", Sequence.EMPTY_SEQUENCE);
        }
       
        ResourceSet result = xqs.execute(query);
        XMLResource resource = (XMLResource) result.getResource(0);
                results.append(resource.getContent()).append('\n');
        Element root = (Element) resource.getContentAsDOM();
        NodeList tests = root.getElementsByTagName("test");
        for (int i = 0; i < tests.getLength(); i++) {
View Full Code Here

            for (File file : files) {
                Document doc = parse(file);

                xqs.declareVariable("doc", doc);
        xqs.declareVariable("id", Sequence.EMPTY_SEQUENCE);
                ResourceSet result = xqs.execute(query);
                XMLResource resource = (XMLResource) result.getResource(0);
                results.append(resource.getContent()).append(EOL);
                Element root = (Element) resource.getContentAsDOM();
                NodeList tests = root.getElementsByTagName("test");
                for (int i = 0; i < tests.getLength(); i++) {
View Full Code Here

                StringBuilder results = new StringBuilder();
                XQueryService xqs = (XQueryService) rootCollection.getService("XQueryService", "1.0");
                xqs.setModuleLoadPath(getDirectory());
                Source query = new FileSource(suite, "UTF-8", false);

                ResourceSet result = xqs.execute(query);
                XMLResource resource = (XMLResource) result.getResource(0);
                results.append(resource.getContent()).append('\n');

                Element root = (Element) resource.getContentAsDOM();
                NodeList testsuites = root.getElementsByTagName("testsuite");
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.