Bug #5186
closedEvents received in XQuery Trace listener with Saxon 10
100%
Description
I'm working to make the Oxygen XML Debugger work with Saxon 10 exactly or close to how it worked with with Saxon 9. So there is an XML and an XQuery, I'm attaching them. The XQuery looks like this:
<BigBoss_subordinates>
{
for $person in doc("personal.xml")/personnel/person
let $link := $person/link
where (exists($link/@manager) and (compare($link/@manager, "Big.Boss") eq 0))
return
<person id="{$person/@id}">
<name>{$person/name/given/text(), " ", $person/name/family/text()}</name>
</person>
}
</BigBoss_subordinates>
We add a net.sf.saxon.lib.TraceListener, with Saxon 10 by default I get on the "net.sf.saxon.lib.TraceListener.enter(Traceable, Map<String, Object>, XPathContext)" callbacks these three initial events:
ENTER class net.sf.saxon.query.XQueryExpression ENTER class net.sf.saxon.expr.flwor.ClauseInfo ENTER class net.sf.saxon.expr.flwor.ClauseInfo
which correspond to the "QUERY" body and to the "FOR" loop inside it, then to the "LET" clause.
With Saxon 9, the same callbacks were with TraceExpression objects, there were more callbacks and one of them was for the "BigBoss_subordinates" element for which with Saxon 10 I receive no callback.
So I started to try and receive more events on the trace listener. I went to patch the method "net.sf.saxon.Configuration.setCompileWithTracing(boolean)" and by default for XQuery it uses a "net.sf.saxon.trace.TraceCodeInjector" which on the method "net.sf.saxon.trace.TraceCodeInjector.isApplicable(Expression)" returns false all the time. What I tried to do for XQuery debugging was to apply a trace code injector like this:
defaultStaticQueryContext.setCodeInjector(
new TraceCodeInjector() {
@Override
protected boolean isApplicable(Expression exp) {
boolean appl = exp.isInstruction() || exp instanceof LetExpression || exp instanceof FixedAttribute
|| exp instanceof FixedElement || exp instanceof FunctionCall;
return appl;
}
});
After this I get more callbacks on the trace listener, I am called for the element "BigBoss_subordinates", I am called for the doc() function call but I no longer receive callbacks for the "FOR", "LET" expressions for which I received callbacks when I did not set the custom trace code injector.
So somehow I do not know why this happens and how to proceed.
Files
Please register to edit this issue