Search in sources :

Example 16 with NameFilter

use of org.sirix.axis.filter.NameFilter in project sirix by sirixdb.

the class XPathParser method parseElementTest.

// /**
// * Parses the the rule AttributeDeclaration according to the following
// * production rule:
// * <p>
// * [62] AttributeDeclaration ::= AttributeName .
// * </p>
// */
// private String parseAttributeDeclaration() {
// 
// return parseAttributeName();
// }
/**
 * Parses the the rule ElementTest according to the following production rule:
 * <p>
 * [63] ElementTest ::= <"element" "("> (ElementNameOrWildcard ("," TypeName "?"?)?)? ")" .
 * </p>
 *
 * @return filter
 */
private Filter parseElementTest() {
    consume("element", true);
    consume(TokenType.OPEN_BR, true);
    Filter filter = new ElementFilter(getTransaction());
    if (!(mToken.getType() == TokenType.CLOSE_BR)) {
        final String mName = parseElementNameOrWildcard();
        if (!mName.equals("*")) {
            filter = new NestedFilter(getTransaction(), filter, new NameFilter(getTransaction(), mName));
        }
        if (is(TokenType.COMMA, true)) {
            filter = new NestedFilter(getTransaction(), filter, new TypeFilter(getTransaction(), parseTypeName()));
            if (is(TokenType.INTERROGATION, true)) {
                // be false
                throw new NoSuchElementException("'?' is not supported yet.");
            }
        }
    }
    consume(TokenType.CLOSE_BR, true);
    return filter;
}
Also used : NestedFilter(org.sirix.axis.filter.NestedFilter) NameFilter(org.sirix.axis.filter.NameFilter) ItemFilter(org.sirix.axis.filter.ItemFilter) AttributeFilter(org.sirix.axis.filter.AttributeFilter) NameFilter(org.sirix.axis.filter.NameFilter) TypeFilter(org.sirix.axis.filter.TypeFilter) NestedFilter(org.sirix.axis.filter.NestedFilter) DocumentRootNodeFilter(org.sirix.axis.filter.DocumentRootNodeFilter) CommentFilter(org.sirix.axis.filter.CommentFilter) WildcardFilter(org.sirix.axis.filter.WildcardFilter) PIFilter(org.sirix.axis.filter.PIFilter) SchemaElementFilter(org.sirix.service.xml.xpath.filter.SchemaElementFilter) Filter(org.sirix.api.Filter) SchemaAttributeFilter(org.sirix.service.xml.xpath.filter.SchemaAttributeFilter) TextFilter(org.sirix.axis.filter.TextFilter) ElementFilter(org.sirix.axis.filter.ElementFilter) NodeFilter(org.sirix.axis.filter.NodeFilter) SchemaElementFilter(org.sirix.service.xml.xpath.filter.SchemaElementFilter) ElementFilter(org.sirix.axis.filter.ElementFilter) TypeFilter(org.sirix.axis.filter.TypeFilter) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

NameFilter (org.sirix.axis.filter.NameFilter)16 FilterAxis (org.sirix.axis.filter.FilterAxis)12 Axis (org.sirix.api.Axis)11 DescendantAxis (org.sirix.axis.DescendantAxis)9 Test (org.junit.Test)8 ChildAxis (org.sirix.axis.ChildAxis)8 XdmNodeReadTrx (org.sirix.api.XdmNodeReadTrx)6 NodeFilter (org.sirix.axis.filter.NodeFilter)5 TextFilter (org.sirix.axis.filter.TextFilter)5 LevelOrderAxis (org.sirix.axis.LevelOrderAxis)4 NestedAxis (org.sirix.axis.NestedAxis)4 PostOrderAxis (org.sirix.axis.PostOrderAxis)4 AttributeFilter (org.sirix.axis.filter.AttributeFilter)4 ElementFilter (org.sirix.axis.filter.ElementFilter)4 ItemFilter (org.sirix.axis.filter.ItemFilter)4 NestedFilter (org.sirix.axis.filter.NestedFilter)4 PathKindFilter (org.sirix.axis.filter.PathKindFilter)4 UnorderedKeyValuePage (org.sirix.page.UnorderedKeyValuePage)4 XPathAxis (org.sirix.service.xml.xpath.XPathAxis)4 Filter (org.sirix.api.Filter)3