use of org.sirix.axis.SelfAxis 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.SelfAxis in project sirix by sirixdb.
the class ExpressionSingleTest method testAdd.
@Test
public void testAdd() throws SirixException {
// Verify.
final ExpressionSingle builder = new ExpressionSingle();
// test one axis
AbstractAxis self = new SelfAxis(holder.getReader());
builder.add(self);
assertEquals(builder.getExpr(), self);
// test 2 axis
AbstractAxis axis1 = new SelfAxis(holder.getReader());
AbstractAxis axis2 = new SelfAxis(holder.getReader());
builder.add(axis1);
builder.add(axis2);
assertTrue(builder.getExpr() instanceof NestedAxis);
}
use of org.sirix.axis.SelfAxis in project sirix by sirixdb.
the class XPathParser method parseContextItemExpr.
/**
* Parses the the rule ContextItemExpr according to the following production rule:
* <p>
* [46] ContextItemExpr ::= "." .
* </p>
*/
private void parseContextItemExpr() {
consume(TokenType.POINT, true);
mPipeBuilder.addStep(new SelfAxis(getTransaction()));
}
Aggregations