use of org.xmldb.api.modules.XPathQueryService in project exist by eXist-db.
the class XQueryTest method predicateInPredicateEmptyResult_1828168.
/**
* @see http://sourceforge.net/support/tracker.php?aid=1828168
*/
@Test
public void predicateInPredicateEmptyResult_1828168() throws XMLDBException {
String query = "let $docs := <Document/> return $docs[a[1] = 'b']";
XPathQueryService service = (XPathQueryService) getTestCollection().getService("XPathQueryService", "1.0");
ResourceSet result = service.query(query);
assertEquals(0, result.getSize());
query = "<a/>[() = 'b']";
service = (XPathQueryService) getTestCollection().getService("XPathQueryService", "1.0");
result = service.query(query);
assertEquals(0, result.getSize());
}
use of org.xmldb.api.modules.XPathQueryService in project exist by eXist-db.
the class XQueryTest method attributeNamespaceDeclaration_1848497.
/**
* @see http://sourceforge.net/support/tracker.php?aid=1848497
*/
@Ignore
@Test
public void attributeNamespaceDeclaration_1848497() throws XMLDBException {
String query = "declare namespace foo = \"foo\";" + "declare function foo:boe() { \"boe\" };" + "<xml xmlns:foo2=\"foo\">{ foo2:boe() }</xml>";
XPathQueryService service = (XPathQueryService) getTestCollection().getService("XPathQueryService", "1.0");
ResourceSet result = service.query(query);
assertEquals(1, result.getSize());
assertEquals(query, "<xml xmlns:foo2=\"foo\">boe</xml>", result.getResource(0).getContent().toString());
}
use of org.xmldb.api.modules.XPathQueryService in project exist by eXist-db.
the class XQueryTest method attribute_1691174.
/**
* @see http://sourceforge.net/tracker/index.php?func=detail&aid=1691174&group_id=17691&atid=117691
*/
@Test
public void attribute_1691174() throws XMLDBException {
String query = "declare function local:show($el1, $el2) { " + " <Foobar> " + " { (\"first: \", $el1, \" second: \", $el2) } " + " </Foobar> " + "}; " + "declare function local:attrib($n as node()) { " + " <Attrib>{$n}</Attrib> " + "}; " + "local:show( " + " <Attrib name=\"value\"/>, " + " local:attrib(attribute name {\"value\"}) (: Exist bug! :) " + ") ";
XPathQueryService service = (XPathQueryService) getTestCollection().getService("XPathQueryService", "1.0");
ResourceSet result = service.query(query);
assertEquals("XQuery: " + query, 1, result.getSize());
}
use of org.xmldb.api.modules.XPathQueryService in project exist by eXist-db.
the class XQueryTest method resolveBaseURI_1841635.
/**
* @see http://sourceforge.net/support/tracker.php?aid=1841635
*/
@Test
public void resolveBaseURI_1841635() throws XMLDBException {
String xmldoc = "<Root><Node1><Node2><Node3></Node3></Node2></Node1></Root>";
XPathQueryService service = storeXMLStringAndGetQueryService("baseuri.xml", xmldoc);
String query = "doc('/db/test/baseuri.xml')/Root/Node1/base-uri()";
ResourceSet result = service.query(query);
assertEquals(1, result.getSize());
assertEquals("/db/test/baseuri.xml", result.getResource(0).getContent().toString());
query = "doc('/db/test/baseuri.xml')/Root/Node1/base-uri()";
result = service.query(query);
assertEquals(1, result.getSize());
assertEquals("/db/test/baseuri.xml", result.getResource(0).getContent().toString());
query = "doc('/db/test/baseuri.xml')/Root/Node1/Node2/base-uri()";
result = service.query(query);
assertEquals(1, result.getSize());
assertEquals("/db/test/baseuri.xml", result.getResource(0).getContent().toString());
query = "doc('/db/test/baseuri.xml')/Root/Node1/Node2/Node3/base-uri()";
result = service.query(query);
assertEquals(1, result.getSize());
assertEquals("/db/test/baseuri.xml", result.getResource(0).getContent().toString());
}
use of org.xmldb.api.modules.XPathQueryService in project exist by eXist-db.
the class XQueryTest method largeAttributeContains.
@Test
public void largeAttributeContains() throws XMLDBException {
ResourceSet result;
String query;
@SuppressWarnings("unused") XMLResource resu;
@SuppressWarnings("unused") 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());
}
Aggregations