use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testAttributes.
@Test
public void testAttributes() {
try {
// Find descendants starting from nodeKey 0L (root).
holder.getReader().moveToDocumentRoot();
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a[@i]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a/@i"), new long[] { 3L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a/@i/@*"), new long[] {});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a/b[@p:x]"), new long[] { 9L });
XPathStringChecker.testIAxisConventions(new XPathAxis(holder.getReader(), "descendant-or-self::node()/@p:x = 'y'"), new String[] { "true" });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[text()]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[element()]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[node()/text()]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[./node()]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[./node()/node()/node()]"), new long[] {});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[//element()]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[/text()]"), new long[] {});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[16<65]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[13>=4]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[13.0>=4]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[4 = 4]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[3=4]"), new long[] {});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[3.2 = 3.22]"), new long[] {});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[(3.2 + 0.02) = 3.22]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[@i = \"j\"]"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "descendant-or-self::node()[@p:x = \"y\"]"), new long[] { 9L });
// IAxisTest.testIAxisConventions(new XPathAxis(holder.getRtx(),
// "p:a[@i eq \"j\"]"),
// new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a[@i=\"k\"]"), new long[] {});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a/b[@p:x=\"y\"]"), new long[] { 9L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testParent.
@Test
public void testParent() {
try {
// Find ancestor starting from nodeKey 8L.
holder.getReader().moveTo(9L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "parent::p:a"), new long[] { 1L });
holder.getReader().moveTo(11L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "parent::b"), new long[] { 9L });
holder.getReader().moveTo(11L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "parent::node()"), new long[] { 9L });
holder.getReader().moveTo(13L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "parent::node()"), new long[] { 1L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testDescendant.
@Test
public void testDescendant() {
try {
// Find descendants starting from nodeKey 0L (root).
holder.getReader().moveToDocumentRoot();
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a//b"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "//p:a"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "descendant-or-self::p:a"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a/descendant-or-self::b"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a/descendant::b"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "p:a/descendant::p:a"), new long[] {});
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testDupElemination.
//
@Test
public void testDupElemination() {
try {
// Find descendants starting from nodeKey 0L (root).
holder.getReader().moveTo(1L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::node()/parent::node()"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "b/c"), new long[] { 7L, 11L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "b/text()"), new long[] { 6L, 12L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a/b/c"), new long[] { 7L, 11L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testSelf.
@Test
public void testSelf() {
try {
// Find ancestor starting from nodeKey 8L.
holder.getReader().moveTo(1L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "self::p:a"), new long[] { 1L });
holder.getReader().moveTo(9L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "self::b"), new long[] { 9L });
holder.getReader().moveTo(11L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "./node()"), new long[] {});
holder.getReader().moveTo(11L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "self::node()"), new long[] { 11L });
holder.getReader().moveTo(1L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "./b/node()"), new long[] { 6L, 7L, 11L, 12L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
Aggregations