Search in sources :

Example 1 with DocumentNodeAxis

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();
    }
}
Also used : DocumentNodeAxis(org.sirix.service.xml.xpath.filter.DocumentNodeAxis) DescendantAxis(org.sirix.axis.DescendantAxis) PrecedingAxis(org.sirix.axis.PrecedingAxis) Axis(org.sirix.api.Axis) DocumentNodeAxis(org.sirix.service.xml.xpath.filter.DocumentNodeAxis) FollowingAxis(org.sirix.axis.FollowingAxis) AbstractAxis(org.sirix.axis.AbstractAxis) AncestorAxis(org.sirix.axis.AncestorAxis) ChildAxis(org.sirix.axis.ChildAxis) FollowingSiblingAxis(org.sirix.axis.FollowingSiblingAxis) FilterAxis(org.sirix.axis.filter.FilterAxis) SelfAxis(org.sirix.axis.SelfAxis) DescendantAxis(org.sirix.axis.DescendantAxis) ParentAxis(org.sirix.axis.ParentAxis) AttributeAxis(org.sirix.axis.AttributeAxis) PrecedingSiblingAxis(org.sirix.axis.PrecedingSiblingAxis)

Aggregations

Axis (org.sirix.api.Axis)1 AbstractAxis (org.sirix.axis.AbstractAxis)1 AncestorAxis (org.sirix.axis.AncestorAxis)1 AttributeAxis (org.sirix.axis.AttributeAxis)1 ChildAxis (org.sirix.axis.ChildAxis)1 DescendantAxis (org.sirix.axis.DescendantAxis)1 FollowingAxis (org.sirix.axis.FollowingAxis)1 FollowingSiblingAxis (org.sirix.axis.FollowingSiblingAxis)1 ParentAxis (org.sirix.axis.ParentAxis)1 PrecedingAxis (org.sirix.axis.PrecedingAxis)1 PrecedingSiblingAxis (org.sirix.axis.PrecedingSiblingAxis)1 SelfAxis (org.sirix.axis.SelfAxis)1 FilterAxis (org.sirix.axis.filter.FilterAxis)1 DocumentNodeAxis (org.sirix.service.xml.xpath.filter.DocumentNodeAxis)1