Search in sources :

Example 1 with PIFilter

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

the class XPathParser method parsePITest.

/**
 * Parses the the rule PITest according to the following production rule:
 * <p>
 * [58] PITest ::= <"processing-instruction" "("> (NCName | StringLiteral)? ")" .
 * </p>
 *
 * @return filter
 */
private Filter parsePITest() {
    consume("processing-instruction", true);
    consume(TokenType.OPEN_BR, true);
    Filter filter = new PIFilter(getTransaction());
    if (!is(TokenType.CLOSE_BR, true)) {
        String stringLiteral;
        if (isQuote()) {
            final byte[] param = ((ValueNode) getTransaction().getItemList().getItem(parseStringLiteral()).get()).getRawValue();
            stringLiteral = Arrays.toString(param);
        } else {
            stringLiteral = parseNCName();
        }
        consume(TokenType.CLOSE_BR, true);
        filter = new NestedFilter(getTransaction(), filter, new NameFilter(getTransaction(), stringLiteral));
    }
    return filter;
}
Also used : NestedFilter(org.sirix.axis.filter.NestedFilter) NameFilter(org.sirix.axis.filter.NameFilter) PIFilter(org.sirix.axis.filter.PIFilter) 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) ValueNode(org.sirix.node.interfaces.ValueNode)

Aggregations

Filter (org.sirix.api.Filter)1 AttributeFilter (org.sirix.axis.filter.AttributeFilter)1 CommentFilter (org.sirix.axis.filter.CommentFilter)1 DocumentRootNodeFilter (org.sirix.axis.filter.DocumentRootNodeFilter)1 ElementFilter (org.sirix.axis.filter.ElementFilter)1 ItemFilter (org.sirix.axis.filter.ItemFilter)1 NameFilter (org.sirix.axis.filter.NameFilter)1 NestedFilter (org.sirix.axis.filter.NestedFilter)1 NodeFilter (org.sirix.axis.filter.NodeFilter)1 PIFilter (org.sirix.axis.filter.PIFilter)1 TextFilter (org.sirix.axis.filter.TextFilter)1 TypeFilter (org.sirix.axis.filter.TypeFilter)1 WildcardFilter (org.sirix.axis.filter.WildcardFilter)1 ValueNode (org.sirix.node.interfaces.ValueNode)1 SchemaAttributeFilter (org.sirix.service.xml.xpath.filter.SchemaAttributeFilter)1 SchemaElementFilter (org.sirix.service.xml.xpath.filter.SchemaElementFilter)1