Search in sources :

Example 11 with XQueryService

use of org.xmldb.api.modules.XQueryService in project exist by eXist-db.

the class SpecialNamesTest method attributes.

@Test
public void attributes() throws XMLDBException {
    XQueryService service = getQueryService();
    @SuppressWarnings("unused") ResourceSet result;
    result = queryAndAssert(service, "<foo amp='x' lt='x' gt='x' apos='x' quot='x'/>", 1, null);
// TODO: could check result
}
Also used : XQueryService(org.xmldb.api.modules.XQueryService) Test(org.junit.Test)

Example 12 with XQueryService

use of org.xmldb.api.modules.XQueryService in project exist by eXist-db.

the class SpecialNamesTest method storeXMLStringAndGetQueryService.

/**
 * stores XML String and get Query Service
 * @param documentName to be stored in the DB
 * @param content to be stored in the DB
 * @return the XQuery Service
 * @throws XMLDBException
 */
@SuppressWarnings("unused")
private XQueryService storeXMLStringAndGetQueryService(String documentName, String content) throws XMLDBException {
    XMLResource doc = (XMLResource) testCollection.createResource(documentName, "XMLResource");
    doc.setContent(content);
    testCollection.storeResource(doc);
    XQueryService service = (XQueryService) testCollection.getService("XPathQueryService", "1.0");
    return service;
}
Also used : XQueryService(org.xmldb.api.modules.XQueryService) XMLResource(org.xmldb.api.modules.XMLResource)

Example 13 with XQueryService

use of org.xmldb.api.modules.XQueryService in project exist by eXist-db.

the class UnionTest method unionInPredicate_withIndex.

@Test
public void unionInPredicate_withIndex() throws XMLDBException {
    storeCollectionConfig();
    final XQueryService service = storeXMLStringAndGetQueryService(PUBMED_DOC_NAME, PUBMED);
    final ResourceSet result = service.queryResource(PUBMED_DOC_NAME, XQUERY);
    assertEquals(1, result.getSize());
}
Also used : XQueryService(org.xmldb.api.modules.XQueryService) ResourceSet(org.xmldb.api.base.ResourceSet)

Example 14 with XQueryService

use of org.xmldb.api.modules.XQueryService in project exist by eXist-db.

the class UnionTest method unionInPredicate_withoutIndex.

@Test
public void unionInPredicate_withoutIndex() throws XMLDBException {
    final XQueryService service = storeXMLStringAndGetQueryService(PUBMED_DOC_NAME, PUBMED);
    final ResourceSet result = service.queryResource(PUBMED_DOC_NAME, XQUERY);
    assertEquals(1, result.getSize());
}
Also used : XQueryService(org.xmldb.api.modules.XQueryService) ResourceSet(org.xmldb.api.base.ResourceSet)

Example 15 with XQueryService

use of org.xmldb.api.modules.XQueryService in project exist by eXist-db.

the class XPathQueryTest method childWildcards.

@Test
public void childWildcards() throws XMLDBException {
    final String docName = "testChildWildcards.xml";
    final XQueryService service = storeXMLStringAndGetQueryService(docName, "<test xmlns=\"http://test\"/>");
    service.setNamespace("t", "http://test");
    // make sure all is well!
    queryResource(service, docName, "/t:test", 1);
    queryResource(service, docName, "/*", 1);
    queryResource(service, docName, "/t:*", 1);
    queryResource(service, docName, "/*:test", 1);
    queryResource(service, docName, "/child::*", 1);
    queryResource(service, docName, "/child::t:*", 1);
    queryResource(service, docName, "/child::*:test", 1);
}
Also used : EXistXQueryService(org.exist.xmldb.EXistXQueryService) XQueryService(org.xmldb.api.modules.XQueryService)

Aggregations

XQueryService (org.xmldb.api.modules.XQueryService)129 EXistXQueryService (org.exist.xmldb.EXistXQueryService)71 XMLResource (org.xmldb.api.modules.XMLResource)33 ResourceSet (org.xmldb.api.base.ResourceSet)29 Test (org.junit.Test)28 Resource (org.xmldb.api.base.Resource)8 Node (org.w3c.dom.Node)6 EXistResource (org.exist.xmldb.EXistResource)5 Document (org.w3c.dom.Document)5 Collection (org.xmldb.api.base.Collection)5 Source (javax.xml.transform.Source)4 IndexQueryService (org.exist.xmldb.IndexQueryService)4 CompiledExpression (org.xmldb.api.base.CompiledExpression)4 XMLDBException (org.xmldb.api.base.XMLDBException)4 Diff (org.xmlunit.diff.Diff)4 Path (java.nio.file.Path)2 XmlRpcTest (org.exist.xmlrpc.XmlRpcTest)2 StringWriter (java.io.StringWriter)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1