Search in sources :

Example 76 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class XQueryFunctionsTest method localName_contextItem.

@Test
public void localName_contextItem() throws XPathException, XMLDBException {
    final ResourceSet result = existEmbeddedServer.executeQuery("let $a := <a><b/></a>" + "return $a/b/fn:local-name()");
    final String r = (String) result.getResource(0).getContent();
    assertEquals("b", r);
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet)

Example 77 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class XQueryFunctionsTest method noeName_empty.

@Test
public void noeName_empty() throws XPathException, XMLDBException {
    final ResourceSet result = existEmbeddedServer.executeQuery("fn:node-name(())");
    assertEquals(0, result.getSize());
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet)

Example 78 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class XQueryFunctionsTest method nodeName_emptyText.

@Test
public void nodeName_emptyText() throws XPathException, XMLDBException {
    final ResourceSet result = existEmbeddedServer.executeQuery("<a>b</a>/fn:node-name(text())");
    assertEquals(0, result.getSize());
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet)

Example 79 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class XQueryFunctionsTest method localName_contextItem_empty.

@Test
public void localName_contextItem_empty() throws XPathException, XMLDBException {
    final ResourceSet result = existEmbeddedServer.executeQuery("let $a := <a><b/></a>" + "return $a/b/c/fn:local-name()");
    final String r = (String) result.getResource(0).getContent();
    assertEquals("", r);
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet)

Example 80 with ResourceSet

use of org.xmldb.api.base.ResourceSet in project exist by eXist-db.

the class XQueryFunctionsTest method documentURI.

@Test
public void documentURI() throws XMLDBException {
    String query = "let $a := <a><b>-1</b><b>-2</b></a> " + "return $a/b[empty(document-uri(.))]";
    ResourceSet result = existEmbeddedServer.executeQuery(query);
    assertEquals(2, result.getSize());
}
Also used : ResourceSet(org.xmldb.api.base.ResourceSet)

Aggregations

ResourceSet (org.xmldb.api.base.ResourceSet)383 XPathQueryService (org.xmldb.api.modules.XPathQueryService)123 Test (org.junit.Test)117 EXistXPathQueryService (org.exist.xmldb.EXistXPathQueryService)100 XMLResource (org.xmldb.api.modules.XMLResource)80 Collection (org.xmldb.api.base.Collection)55 Resource (org.xmldb.api.base.Resource)45 XQueryService (org.xmldb.api.modules.XQueryService)29 XMLDBException (org.xmldb.api.base.XMLDBException)23 EXistResource (org.exist.xmldb.EXistResource)20 BinaryResource (org.xmldb.api.modules.BinaryResource)17 CollectionManagementService (org.xmldb.api.modules.CollectionManagementService)14 Node (org.w3c.dom.Node)11 IndexQueryService (org.exist.xmldb.IndexQueryService)9 Diff (org.xmlunit.diff.Diff)9 EXistCollectionManagementService (org.exist.xmldb.EXistCollectionManagementService)8 UserManagementService (org.exist.xmldb.UserManagementService)8 Source (javax.xml.transform.Source)7 ResourceIterator (org.xmldb.api.base.ResourceIterator)7 XUpdateQueryService (org.xmldb.api.modules.XUpdateQueryService)6