use of org.sirix.service.xml.xpath.filter.DocumentNodeAxis in project sirix by sirixdb.
the class XPathParser method parsePathExpr.
/**
* Parses the the rule PathExpr according to the following production rule:
* <p>
* [25] PathExpr ::= ("/" RelativePathExpr?) | ("//" RelativePathExpr) | RelativePathExpr .
* </p>
*
* @throws SirixXPathException
*/
private void parsePathExpr() throws SirixXPathException {
if (is(TokenType.SLASH, true)) {
// path expression starts from the root
mPipeBuilder.addStep(new DocumentNodeAxis(getTransaction()));
final TokenType type = mToken.getType();
if (type != TokenType.END && type != TokenType.COMMA) {
// all immediately following keywords or '*' are nametests, not
// operators
// leading-lone-slash constrain
parseRelativePathExpr();
}
} else if (is(TokenType.DESC_STEP, true)) {
// path expression starts from the root with a descendant-or-self
// step
mPipeBuilder.addStep(new DocumentNodeAxis(getTransaction()));
final Axis mAxis = new DescendantAxis(getTransaction(), IncludeSelf.YES);
mPipeBuilder.addStep(mAxis);
parseRelativePathExpr();
} else {
parseRelativePathExpr();
}
}
Aggregations