use of org.sirix.axis.AttributeAxis in project sirix by sirixdb.
the class XPathParser method parseForwardAxis.
/**
* Parses the the rule ForwardAxis according to the following production rule:
* <p>
* [30] ForwardAxis ::= <"child" "::"> | <"descendant" "::"> | <"attribute" "::"> | <"self" "::">
* | <"descendant-or-self" "::"> | <"following-sibling" "::"> | <"following" "::"> | <"namespace"
* "::"> .
* </p>
*
* @return axis
* @throws SirixXPathException
*/
private Axis parseForwardAxis() throws SirixXPathException {
final Axis axis;
if (is("child", true)) {
axis = new ChildAxis(getTransaction());
} else if (is("descendant", true)) {
axis = new DescendantAxis(getTransaction());
} else if (is("descendant-or-self", true)) {
axis = new DescendantAxis(getTransaction(), IncludeSelf.YES);
} else if (is("attribute", true)) {
axis = new AttributeAxis(getTransaction());
} else if (is("self", true)) {
axis = new SelfAxis(getTransaction());
} else if (is("following", true)) {
axis = new FollowingAxis(getTransaction());
} else if (is("following-sibling", true)) {
axis = new FollowingSiblingAxis(getTransaction());
} else {
is("namespace", true);
throw EXPathError.XPST0010.getEncapsulatedException();
}
consume(TokenType.COLON, true);
consume(TokenType.COLON, true);
return axis;
}
use of org.sirix.axis.AttributeAxis in project sirix by sirixdb.
the class FilterAxisTest method testValueAndNameAxisTest.
@Test
public void testValueAndNameAxisTest() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
rtx.moveTo(1L);
AbsAxisTest.testIAxisConventions(new FilterAxis(new AttributeAxis(rtx), new NameFilter(rtx, "i"), new ValueFilter(rtx, "j")), new long[] { 3L });
rtx.moveTo(9L);
AbsAxisTest.testIAxisConventions(new FilterAxis(new AttributeAxis(rtx), new NameFilter(rtx, "y"), new ValueFilter(rtx, "y")), new long[] {});
}
use of org.sirix.axis.AttributeAxis in project sirix by sirixdb.
the class XPathParser method parseAbbrevForwardStep.
/**
* Parses the the rule AbrevForwardStep according to the following production rule:
* <p>
* [31] AbbrevForwardStep ::= "@"? NodeTest .
* </p>
*
* @return FilterAxis
*/
private AbstractAxis parseAbbrevForwardStep() {
AbstractAxis axis;
boolean isAttribute;
if (is(TokenType.AT, true) || mToken.getContent().equals("attribute") || mToken.getContent().equals("schema-attribute")) {
// in case of .../attribute(..), or .../schema-attribute() the
// default
// axis
// is the attribute axis
axis = new AttributeAxis(getTransaction());
isAttribute = true;
} else {
// default axis is the child axis
axis = new ChildAxis(getTransaction());
isAttribute = false;
}
final Filter filter = parseNodeTest(isAttribute);
return new FilterAxis(axis, filter);
}
Aggregations