Package org.xmldb.api.modules

Examples of org.xmldb.api.modules.XPathQueryService


        XMLResource doc = (XMLResource)
                sub2.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource");
        doc.setContent(DOCUMENT_CONTENT);
        sub2.storeResource(doc);

        XPathQueryService service = (XPathQueryService)
                sub2.getService("XPathQueryService", "1.0");

        //3 numeric values
        ResourceSet result = service.query("util:index-key-occurrences(/test/a, 1)");
        assertEquals("3", result.getResource(0).getContent());
        //... but 1 string value
        result = service.query("util:index-key-occurrences(/test/b, \"1\")");
        assertEquals("1", result.getResource(0).getContent());

            //3 numeric values
        result = service.query("util:qname-index-lookup(xs:QName(\"a\"), 1 ) ");
        assertEquals(3, result.getSize());
        //... but 1 string value
        result = service.query("util:qname-index-lookup(xs:QName(\"b\"), \"1\" ) ");
        assertEquals(1, result.getSize());
   }
View Full Code Here


        XMLResource doc = (XMLResource)
                sub2.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource");
        doc.setContent(DOCUMENT_CONTENT);
        sub2.storeResource(doc);

        XPathQueryService service = (XPathQueryService)
                sub2.getService("XPathQueryService", "1.0");

        // index should be empty
        ResourceSet result = service.query("util:index-key-occurrences(/test/a, 1)");
        assertEquals(0, result.getSize());
        result = service.query("util:index-key-occurrences(/test/b, \"1\")");
        assertEquals(0, result.getSize());

        result = service.query("util:qname-index-lookup(xs:QName(\"a\"), 1 ) ");
        assertEquals(0, result.getSize());
        result = service.query("util:qname-index-lookup(xs:QName(\"b\"), \"1\" ) ");
        assertEquals(0, result.getSize());
   }
View Full Code Here

        //... then store document into sub1
        XMLResource doc = (XMLResource)sub1.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource");
        doc.setContent(DOCUMENT_CONTENT);
        sub1.storeResource(doc);

        XPathQueryService service = (XPathQueryService)sub1.getService("XPathQueryService", "1.0");

        // sub1 has empty configuration, so index should be empty as well
        ResourceSet result = service.query("util:index-key-occurrences(/test/a, 1)");
        assertEquals(0, result.getSize());
        result = service.query("util:index-key-occurrences(/test/b, \"1\")");
        assertEquals(0, result.getSize());

        result = service.query("util:qname-index-lookup(xs:QName(\"a\"), 1 ) ");
        assertEquals(0, result.getSize());
        result = service.query("util:qname-index-lookup(xs:QName(\"b\"), \"1\" ) ");
        assertEquals(0, result.getSize());

        // remove document in sub1 and restore it in sub2
        sub1.removeResource(doc);
        doc = (XMLResource)sub2.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource");
        doc.setContent(DOCUMENT_CONTENT);
        sub2.storeResource(doc);

        service = (XPathQueryService) sub2.getService("XPathQueryService", "1.0");

        // sub2 only has an index on /test/a, but not on /test/b

        //3 numeric values
       result = service.query("util:index-key-occurrences(/test/a, 1)");
       assertEquals("3", result.getResource(0).getContent());
       //... but 1 string value
       result = service.query("util:index-key-occurrences(/test/b, \"1\")");
       assertEquals(0, result.getSize());

       // 3 numeric values
       result = service.query("util:qname-index-lookup( xs:QName(\"a\"), 1 ) ");
       assertEquals(3, result.getSize());
       // ... but 1 string value
       result = service.query("util:qname-index-lookup( xs:QName(\"b\"), \"1\" ) ");
       assertEquals(0, result.getSize());
   }
View Full Code Here

        XMLResource doc = (XMLResource)
                sub2.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource");
        doc.setContent(DOCUMENT_CONTENT);
        sub2.storeResource(doc);

        XPathQueryService service = (XPathQueryService) sub2.getService("XPathQueryService", "1.0");

        //3 numeric values
        ResourceSet result = service.query("util:index-key-occurrences(/test/a, 1)");
        assertEquals("3", result.getResource(0).getContent());
        //... but 1 string value
        result = service.query("util:index-key-occurrences(/test/b, \"1\")");
        assertEquals("1", result.getResource(0).getContent());

            //3 numeric values
        result = service.query("util:qname-index-lookup(xs:QName(\"a\"), 1 ) ");
        assertEquals(3, result.getSize());
        //... but 1 string value
        result = service.query("util:qname-index-lookup(xs:QName(\"b\"), \"1\" ) ");
        assertEquals(1, result.getSize());

        // remove config document thus dropping the configuration
        Collection confCol = DatabaseManager.getCollection("xmldb:exist://" + CONF_COLL_URI.toString(), ADMIN_UID, ADMIN_PWD);
        Resource confDoc = confCol.getResource("collection.xconf");
        assertNotNull(confDoc);
        confCol.removeResource(confDoc);
//            cms = (CollectionManagementService) confCol.getService("CollectionManagementService", "1.0");
//            cms.removeCollection(".");

        idxConf.reindexCollection();

        // index should be empty since configuration was removed
        result = service.query("util:index-key-occurrences(/test/a, 1)");
        assertEquals(0, result.getSize());
        result = service.query("util:index-key-occurrences(/test/b, \"1\")");
        assertEquals(0, result.getSize());

        result = service.query("util:qname-index-lookup(xs:QName(\"a\"), 1 ) ");
        assertEquals(0, result.getSize());
        result = service.query("util:qname-index-lookup(xs:QName(\"b\"), \"1\" ) ");
        assertEquals(0, result.getSize());
   }
View Full Code Here

        XMLResource doc = (XMLResource)
                sub2.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource");
        doc.setContent(DOCUMENT_CONTENT);
        sub2.storeResource(doc);

        XPathQueryService service = (XPathQueryService) sub2.getService("XPathQueryService", "1.0");

        //3 numeric values
        ResourceSet result = service.query("util:index-key-occurrences(/test/a, 1)");
        assertEquals("3", result.getResource(0).getContent());
        //... but 1 string value
        result = service.query("util:index-key-occurrences(/test/b, \"1\")");
        assertEquals("1", result.getResource(0).getContent());

            //3 numeric values
        result = service.query("util:qname-index-lookup(xs:QName(\"a\"), 1 ) ");
        assertEquals(3, result.getSize());
        //... but 1 string value
        result = service.query("util:qname-index-lookup(xs:QName(\"b\"), \"1\" ) ");
        assertEquals(1, result.getSize());

        // remove config document thus dropping the configuration
        Collection confCol = DatabaseManager.getCollection("xmldb:exist://" + CONF_COLL_URI.toString(), ADMIN_UID, ADMIN_PWD);
        Resource confDoc = confCol.getResource("collection.xconf");
        assertNotNull(confDoc);
        confCol.removeResource(confDoc);

        idxConf.reindexCollection();

        // index should be empty since configuration was removed
        result = service.query("util:index-key-occurrences(/test/a, 1)");
        assertEquals(0, result.getSize());
        result = service.query("util:index-key-occurrences(/test/b, \"1\")");
        assertEquals(0, result.getSize());

        result = service.query("util:qname-index-lookup(xs:QName(\"a\"), 1 ) ");
        assertEquals(0, result.getSize());
        result = service.query("util:qname-index-lookup(xs:QName(\"b\"), \"1\" ) ");
        assertEquals(0, result.getSize());
   }
View Full Code Here

        XMLResource doc = (XMLResource)
                sub2.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource");
        doc.setContent(DOCUMENT_CONTENT);
        sub2.storeResource(doc);

        XPathQueryService service = (XPathQueryService) sub2.getService("XPathQueryService", "1.0");

        // index should be empty since configuration was invalid
        ResourceSet result = service.query("util:index-key-occurrences(/test/a, 1)");
        assertEquals(0, result.getSize());

        result = service.query("util:qname-index-lookup(xs:QName(\"a\"), 1 ) ");
        assertEquals(0, result.getSize());
    }
View Full Code Here

       XMLResource doc = (XMLResource)
       testCollection.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource" );
       doc.setContent(DOCUMENT_CONTENT2);
       testCollection.storeResource(doc);

       XPathQueryService service = (XPathQueryService)
       testCollection.getService("XPathQueryService", "1.0");

       ResourceSet result = service.query("util:index-key-occurrences(/test/c, xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/c)");
       assertEquals("xs:dateTime", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/d, xs:double(1) )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/d)");
       assertEquals("xs:double", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/e, xs:float(1) )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/e)");
       assertEquals("xs:float", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/f, true())");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/f)");
       assertEquals("xs:boolean", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/g, xs:integer(1))");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/g)");
       assertEquals("xs:integer", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/h, '1')");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/h)");
       assertEquals("xs:string", result.getResource(0).getContent());

       result = service.query("/test/c[(# exist:force-index-use #) { . = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { c = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/d[(# exist:force-index-use #) { . = xs:double(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { d = xs:double(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/e[(# exist:force-index-use #) { . = xs:float(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { e = xs:float(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/f[(# exist:force-index-use #) { . = true() }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { f = true() }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/g[(# exist:force-index-use #) { . = 1 }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { g = 1 }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/h[(# exist:force-index-use #) { . = '1' }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { h = '1' }]");
       assertEquals(1, result.getSize());

       boolean exceptionCaught = false;
       try {
           result = service.query("/test[(# exist:force-index-use #) { contains(d, '1') }]");
           assertEquals(0, result.getSize());
       } catch (XMLDBException e) {
           exceptionCaught = true;
       }
       assertTrue("contains() should not use index of type xs:double", exceptionCaught);
       exceptionCaught = false;
       try {
           result = service.query("/test[(# exist:force-index-use #) { matches(d, '1') }]");
           assertEquals(0, result.getSize());
       } catch (XMLDBException e) {
           exceptionCaught = true;
       }
       assertTrue("matches() should not use index of type xs:double", exceptionCaught);

       result = service.query("/test[matches(h, '1')]");
       assertEquals(1, result.getSize());
  }  
View Full Code Here

       XMLResource doc = (XMLResource)
       testCollection.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource" );
       doc.setContent(DOCUMENT_CONTENT2);
       testCollection.storeResource(doc);

       XPathQueryService service = (XPathQueryService)
       testCollection.getService("XPathQueryService", "1.0");

       ResourceSet result = service.query("util:index-key-occurrences(/test/c, xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/c)");
       assertEquals("xs:dateTime", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/d, xs:double(1) )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/d)");
       assertEquals("xs:double", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/e, xs:float(1) )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/e)");
       assertEquals("xs:float", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/f, true())");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/f)");
       assertEquals("xs:boolean", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/g, xs:integer(1))");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/g)");
       assertEquals("xs:integer", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/h, '1')");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/h)");
       assertEquals("xs:string", result.getResource(0).getContent());

       result = service.query("(# exist:force-index-use #) { /test/c[. = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\")] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test[c = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\")] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test/d[. = xs:double(1)] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test[d = xs:double(1)] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test/e[. = xs:float(1)] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test[e = xs:float(1)] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test/f[. = true()] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test[f = true()] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test/g[. = 1] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test[g = 1] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test/h[. = '1'] }");
       assertEquals(1, result.getSize());

       result = service.query("(# exist:force-index-use #) { /test[h = '1'] }");
       assertEquals(1, result.getSize());

       boolean exceptionCaught = false;
       try {
           result = service.query("(# exist:force-index-use #) { /test[contains(d, '1')] }");
           assertEquals(0, result.getSize());
       } catch (XMLDBException e) {
           exceptionCaught = true;
       }
       assertTrue("contains() should not use index of type xs:double", exceptionCaught);
       exceptionCaught = false;
       try {
           result = service.query("(# exist:force-index-use #) { /test[matches(d, '1')] }");
           assertEquals(0, result.getSize());
       } catch (XMLDBException e) {
           exceptionCaught = true;
       }
       assertTrue("matches() should not use index of type xs:double", exceptionCaught);

       result = service.query("/test[matches(h, '1')]");
       assertEquals(1, result.getSize());
  }
View Full Code Here

       XMLResource doc = (XMLResource)
       testCollection.createResource(TestConstants.TEST_XML_URI.toString(), "XMLResource" );
       doc.setContent(DOCUMENT_CONTENT2);
       testCollection.storeResource(doc);

       XPathQueryService service = (XPathQueryService)
       testCollection.getService("XPathQueryService", "1.0");

       ResourceSet result = service.query("//test[@x = 0]");
       assertEquals(1, result.getSize());

       result = service.query("//test[@x eq 0]");
       assertEquals(1, result.getSize());

       result = service.query("//test[(# exist:force-index-use #) { @x = 0 }]");
       assertEquals(1, result.getSize());

       result = service.query("//test[(# exist:force-index-use #) { @x eq 0 }]");
       assertEquals(1, result.getSize());

       result = service.query("util:index-key-occurrences(/test//@c, xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test//@c)");
       assertEquals("xs:dateTime", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/c/@c, xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/c/@c)");
       assertEquals("xs:dateTime", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test//@d, xs:double(1) )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test//@d)");
       assertEquals("xs:double", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/d/@d, xs:double(1) )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/d/@d)");
       assertEquals("xs:double", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test//@e, xs:float(1) )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test//@e)");
       assertEquals("xs:float", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/e/@e, xs:float(1) )");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/e/@e)");
       assertEquals("xs:float", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test//@f, true())");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test//@f)");
       assertEquals("xs:boolean", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/f/@f, true())");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/f/@f)");
       assertEquals("xs:boolean", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test//@g, xs:integer(1))");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test//@g)");
       assertEquals("xs:integer", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/g/@g, xs:integer(1))");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/g/@g)");
       assertEquals("xs:integer", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test//@h, '1')");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test//@h)");
       assertEquals("xs:string", result.getResource(0).getContent());

       result = service.query("util:index-key-occurrences(/test/h/@h, '1')");
       assertEquals(1, result.getSize());
       assertEquals("1", result.getResource(0).getContent());

       result = service.query("util:index-type(/test/h/@h)");
       assertEquals("xs:string", result.getResource(0).getContent());

       result = service.query("/test//@c[(# exist:force-index-use #) { . = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { .//@c = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/c/@c[(# exist:force-index-use #) { . = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { ./c/@c = xs:dateTime(\"2002-12-07T12:20:46.275+01:00\") }]");
       assertEquals(1, result.getSize());

       result = service.query("/test//@d[(# exist:force-index-use #) { . = xs:double(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { .//@d = xs:double(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/d/@d[(# exist:force-index-use #) { . = xs:double(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { ./d/@d = xs:double(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test//@e[(# exist:force-index-use #) { . = xs:float(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { .//@e = xs:float(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/e/@e[(# exist:force-index-use #) { . = xs:float(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { ./e/@e = xs:float(1) }]");
       assertEquals(1, result.getSize());

       result = service.query("/test//@f[(# exist:force-index-use #) { . = true() }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { .//@f = true() }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/f/@f[(# exist:force-index-use #) { . = true() }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { ./f/@f = true() }]");
       assertEquals(1, result.getSize());

       result = service.query("/test//@g[(# exist:force-index-use #) { . = 1 }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { .//@g = 1 }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/g/@g[(# exist:force-index-use #) { . = 1 }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { ./g/@g = 1 }]");
       assertEquals(1, result.getSize());

       result = service.query("/test//@h[(# exist:force-index-use #) { . = '1' }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { .//@h = '1' }]");
       assertEquals(1, result.getSize());

       result = service.query("/test/h/@h[(# exist:force-index-use #) { . = '1' }]");
       assertEquals(1, result.getSize());

       result = service.query("/test[(# exist:force-index-use #) { ./h/@h = '1' }]");
       assertEquals(1, result.getSize());
  }  
View Full Code Here

        @SuppressWarnings("unused")
    boolean exceptionThrown;
        @SuppressWarnings("unused")
    String message;
        try {
            XPathQueryService service =
                    storeXMLStringAndGetQueryService(NUMBERS_XML, numbers);

            System.out.println("testPrecedence 1: ========");
            query = "xquery version \"1.0\";\n" + "declare namespace blah=\"blah\";\n" + "declare variable $blah:param  {\"value-1\"};\n" + "let $blah:param := \"value-2\"\n" + "(:: FLWOR expressions have a higher precedence than the comma operator ::)\n" + "return $blah:param, $blah:param ";
            result = service.query(query);
            assertEquals("XQuery: " + query, 2, result.getSize());
            assertEquals("XQuery: " + query, "value-2", ((XMLResource) result.getResource(0)).getContent());
            assertEquals("XQuery: " + query, "value-1", ((XMLResource) result.getResource(1)).getContent());

        } catch (XMLDBException e) {
View Full Code Here

TOP

Related Classes of org.xmldb.api.modules.XPathQueryService

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.