Search in sources :

Example 1 with NodeTest

use of net.sf.saxon.pattern.NodeTest in project teiid by teiid.

the class PathMapFilter method startElement.

@Override
public void startElement(NodeName elemName, SchemaType typeCode, Location locationId, int properties) throws XPathException {
    MatchContext mc = matchContext.getLast();
    MatchContext newContext = new MatchContext();
    if (mc.elementArcs != null) {
        for (PathMapArc arc : mc.elementArcs) {
            NodeTest test = arc.getNodeTest();
            if (test == null || test.matches(Type.ELEMENT, elemName, typeCode)) {
                newContext.bulidContext(arc.getTarget());
                newContext.matchedElement = true;
                if (arc.getTarget().isAtomized() && arc.getTarget().getArcs().length == 0) {
                    // we must expect the text as there are no further arcs
                    newContext.matchesText = true;
                }
            }
            if (arc.getAxis() == AxisInfo.DESCENDANT || arc.getAxis() == AxisInfo.DESCENDANT_OR_SELF) {
                newContext.processArc(arc);
            }
        }
    }
    matchContext.add(newContext);
    if (newContext.matchedElement) {
        super.startElement(elemName, typeCode, locationId, properties);
    } else if (logTrace) {
        // $NON-NLS-1$
        LogManager.logTrace(LogConstants.CTX_RUNTIME, "Document projection did not match element", elemName.getURI(), ':', elemName.getLocalPart());
    }
}
Also used : PathMapArc(net.sf.saxon.expr.parser.PathMap.PathMapArc) NodeTest(net.sf.saxon.pattern.NodeTest)

Aggregations

PathMapArc (net.sf.saxon.expr.parser.PathMap.PathMapArc)1 NodeTest (net.sf.saxon.pattern.NodeTest)1