Examples of queryResource()


Examples of org.xmldb.api.modules.XPathQueryService.queryResource()

            assertEquals(1, result.getSize());
            resu = (XMLResource) result.getResource(0);
            assertEquals("XQuery: " + query, "world", resu.getContent().toString());

            query = "//node/node()";
            result = service.queryResource("cdata.xml", query);
            assertEquals(1, result.getSize());
            resu = (XMLResource) result.getResource(0);
            assertEquals("XQuery: " + query, "world", resu.getContent().toString());

            query = "/root[node = 'world']";
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService.queryResource()

            assertEquals(1, result.getSize());
            resu = (XMLResource) result.getResource(0);
            assertEquals("XQuery: " + query, "world", resu.getContent().toString());

            query = "/root[node = 'world']";
            result = service.queryResource("cdata.xml", query);
            assertEquals(1, result.getSize());
            resu = (XMLResource) result.getResource(0);
            assertEquals("XQuery: " + query, xml, resu.getContent().toString());
        } catch (XMLDBException e) {
            System.out.println("testCDATAQuery(): XMLDBException: " + e);
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService.queryResource()

      String large = createXMLContentWithLargeString();
            XPathQueryService service =
                    storeXMLStringAndGetQueryService(file_name, xml);

            query = "doc('" + file_name + "') / details/metadata[ contains(@docid, 'aa') ]";
            result = service.queryResource(file_name, query);
            assertEquals("XQuery: " + query, nbElem, result.getSize());
        } catch (XMLDBException e) {
            System.out.println("testLargeAttributeSimple(): XMLDBException: " + e);
            fail(e.getMessage());
        }
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService.queryResource()

            String large = createXMLContentWithLargeString();
            XPathQueryService service =
                    storeXMLStringAndGetQueryService(file_name, xml);

            query = "doc('" + file_name + "') / details/metadata[ @docid = '" + large + "' ]";
            result = service.queryResource(file_name, query);
            assertEquals("XQuery: " + query, nbElem, result.getSize());
        } catch (XMLDBException e) {
            System.out.println("testLargeAttributeSimple(): XMLDBException: " + e);
            fail(e.getMessage());
        }
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService.queryResource()

 
    public static ResourceSet queryResource(Collection collection, String resource, String xpath)
    throws XMLDBException
    {
        XPathQueryService service = getQueryService(collection);
        return service.queryResource(resource, xpath);
    }
   
  public static ResourceSet xquery(Collection collection, String xquery)
  throws XMLDBException
  {
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService.queryResource()

    ResourceSet result = null;
    if ( xquery != "") {
      // xquery = "/*/*[2]";
      System.out.println("Querying \""+xquery+"\" ..." );
      long t0 = System.currentTimeMillis();
      result = service.queryResource( "big.xml", xquery );
      // assertEquals(1, result.getSize());
      long t1 = System.currentTimeMillis();
      System.out.println("Time for query \""+xquery+"\" on "+ mess + ": " + ( t1-t0) + " ms." );
    }
    return result;
View Full Code Here

Examples of org.xmldb.api.modules.XPathQueryService.queryResource()

        final XPathQueryService query =
                (XPathQueryService) testCollection.getService(
                "XPathQueryService",
                "1.0");
        ResourceSet result = query.queryResource("strings2.xml", "/test/string[. = 'Hello World!']");
        assertEquals(1, result.getSize());

        result = query.query("/test/string[. = 'Hello World!']");
        assertEquals(2, result.getSize());
    }
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService.queryResource()

            Resource resource = root.createResource("data.xml", "XMLResource");
            resource.setContent(DOCUMENT_CONTENT);
            root.storeResource(resource);
            printMessages();
            XQueryService qs = (XQueryService) root.getService("XQueryService", "1.0");
            ResourceSet result = qs.queryResource("messages.xml", "string(//event[last()]/@collection)");
            assertEquals(1, result.getSize());
            assertEquals(testCollection, result.getResource(0).getContent());
        } catch (XMLDBException e) {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService.queryResource()

            root.storeResource(resource);

            root.removeResource(resource);

            XQueryService qs = (XQueryService) root.getService("XQueryService", "1.0");
            ResourceSet result = qs.queryResource("messages.xml", "string(//event[last()]/@collection)");
            assertEquals(1, result.getSize());
            assertEquals(testCollection, result.getResource(0).getContent());
        } catch (XMLDBException e) {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

Examples of org.xmldb.api.modules.XQueryService.queryResource()

                "  for $one_item in $all_items " +
                "      / ancestor::*  (: <<<<< if you remove this line all is normal :)" +
                "    return 'foo'" +
                "return $all_items";

        final ResourceSet result = service.queryResource("numbers.xml", query );
        assertEquals(4, result.getSize());
    }

    @Test
    public void namespaces() throws XMLDBException {
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.