use of org.sirix.axis.filter.WildcardFilter in project sirix by sirixdb.
the class XPathParser method parseWildcard.
/**
* Parses the the rule Wildcard according to the following production rule:
* <p>
* [37] Wildcard ::= "*" | < NCName ":" "*" > | < "*" ":" NCName > .
* <p>
*
* @param pIsAtt Attribute
* @return filter
*/
private Filter parseWildcard(final boolean pIsAtt) {
Filter filter;
EType isName = EType.PREFIX;
if (is(TokenType.STAR, true)) {
if (is(TokenType.COLON, true)) {
// < "*" ":" NCName > .
isName = EType.LOCALNAME;
} else {
return // "*"
pIsAtt ? new AttributeFilter(getTransaction()) : new ElementFilter(getTransaction());
}
}
filter = new WildcardFilter(getTransaction(), parseNCName(), isName);
if (isName == EType.PREFIX) {
// < NCName ":" "*" >
consume(TokenType.COLON, true);
consume(TokenType.STAR, true);
}
return filter;
}
use of org.sirix.axis.filter.WildcardFilter in project sirix by sirixdb.
the class WildcardFilterTest method testFilterConvetions.
@Test
public void testFilterConvetions() throws SirixException {
holder.getReader().moveTo(9L);
FilterTest.testFilterConventions(new WildcardFilter(holder.getReader(), "b", EType.LOCALNAME), true);
holder.getReader().moveToAttribute(0);
FilterTest.testFilterConventions(new WildcardFilter(holder.getReader(), "p", EType.PREFIX), true);
holder.getReader().moveTo(1L);
FilterTest.testFilterConventions(new WildcardFilter(holder.getReader(), "p", EType.PREFIX), true);
FilterTest.testFilterConventions(new WildcardFilter(holder.getReader(), "a", EType.LOCALNAME), true);
FilterTest.testFilterConventions(new WildcardFilter(holder.getReader(), "c", EType.LOCALNAME), false);
FilterTest.testFilterConventions(new WildcardFilter(holder.getReader(), "b", EType.PREFIX), false);
}
Aggregations