Package org.pdf4j.saxon.trace

Examples of org.pdf4j.saxon.trace.TraceListener


        c2.setCurrentIterator(iter);
        c2.setCurrentTemplateRule(null);

        if (containsTailCall) {
            if (controller.isTracing()) {
                TraceListener listener = controller.getTraceListener();
                Item item = iter.next();
                if (item == null) {
                    return null;
                }
                listener.startCurrentItem(item);
                TailCall tc = ((TailCallReturner)action).processLeavingTail(c2);
                listener.endCurrentItem(item);
                return tc;
            } else {
                Item item = iter.next();
                if (item == null) {
                    return null;
                }
                return ((TailCallReturner)action).processLeavingTail(c2);
            }
        } else {
            if (controller.isTracing()) {
                TraceListener listener = controller.getTraceListener();
                while(true) {
                    Item item = iter.next();
                    if (item == null) {
                        break;
                    }
                    listener.startCurrentItem(item);
                    action.process(c2);
                    listener.endCurrentItem(item);
                }
            } else {
                while(true) {
                    Item item = iter.next();
                    if (item == null) {
View Full Code Here


     * @return either null, or a tail call that the caller must invoke on return
     * @throws org.pdf4j.saxon.trans.XPathException
     */
    public TailCall processLeavingTail(XPathContext context) throws XPathException {
        Controller controller = context.getController();
        TraceListener listener = controller.getTraceListener();
      if (controller.isTracing()) {
             listener.enter(getInstructionInfo(), context);
        }
        // Don't attempt tail call optimization when tracing, the results are too confusing
        child.process(context);
         if (controller.isTracing()) {
             listener.leave(getInstructionInfo());
        }
        return null;
    }
View Full Code Here

                                              // No need to open a new stack frame!
                    defaultAction(node, parameters, tunnelParameters, context, backwardsCompatible, locationId);

                } else {
                    Template template = (Template)rule.getAction();
                    TraceListener traceListener = controller.getTraceListener();
                    context.setLocalParameters(parameters);
                    context.setTunnelParameters(tunnelParameters);
                    context.openStackFrame(template.getStackFrameMap());
                    traceListener.startCurrentItem(node);
                    tc = template.applyLeavingTail(context, rule);
                    traceListener.endCurrentItem(node);
                }
            }

        } else {    // not tracing
View Full Code Here

        controller.defineGlobalParameters();

        XPathContextMajor context = initialContext(env, controller);

        // In tracing/debugging mode, evaluate all the global variables first
        TraceListener tracer = controller.getTraceListener();
        if (tracer != null) {
            controller.preEvaluateGlobals(context);
            tracer.open();
        }

        context.openStackFrame(stackFrameMap);

        boolean mustClose = (result instanceof StreamResult &&
                ((StreamResult)result).getOutputStream() == null);
        context.changeOutputDestination(actualProperties, result, true,
                Configuration.XQUERY, Validation.PRESERVE, null);
        context.getReceiver().open();

        // Run the query
        try {
            expression.process(context);
        } catch (XPathException err) {
            controller.reportFatalError(err);
            throw err;
        }

        if (tracer != null) {
            tracer.close();
        }

        context.getReceiver().close();
        if (mustClose) {
            OutputStream os = ((StreamResult)result).getOutputStream();
View Full Code Here

        info.setConstructType(Location.TRACE_CALL);
        info.setLineNumber(getLineNumber());
        info.setSystemId(getSystemId());
        info.setProperty("label", label);
        info.setProperty("value", val);
        TraceListener listener = context.getController().getTraceListener();
        listener.enter(info, context);
        listener.leave(info);
    }
View Full Code Here

        c2.setCurrentIterator(groupIterator);
        c2.setCurrentGroupIterator(groupIterator);
        c2.setCurrentTemplateRule(null);

        if (controller.isTracing()) {
            TraceListener listener = controller.getTraceListener();
            while (true) {
                Item item = groupIterator.next();
                if (item == null) {
                    break;
                }
                listener.startCurrentItem(item);
                action.process(c2);
                listener.endCurrentItem(item);
            }
        } else {
            while (true) {
                Item item = groupIterator.next();
                if (item == null) {
View Full Code Here

                            showTime = true;
                        }
                        i++;
                    } else if (option.equals("T")) {
                        i++;
                        TraceListener traceListener;
                        if (value == null) {
                            traceListener = new org.pdf4j.saxon.trace.XSLTTraceListener();
                        } else {
                            traceListener = config.makeTraceListener(value);
                        }
                        factory.setAttribute(FeatureKeys.TRACE_LISTENER, traceListener);
                        factory.setAttribute(FeatureKeys.LINE_NUMBERING, Boolean.TRUE);

                    } else if (option.equals("TJ")) {
                        i++;
                        factory.setAttribute(FeatureKeys.TRACE_EXTERNAL_FUNCTIONS,
                                Boolean.TRUE);
                    } else if (option.equals("TL")) {
                        i++;
                        if (args.length < i + 2) {
                            badUsage(command, "No TraceListener class");
                        }
                        TraceListener traceListener = config.makeTraceListener(args[i++]);
                        factory.setAttribute(FeatureKeys.TRACE_LISTENER,
                                traceListener);
                        factory.setAttribute(FeatureKeys.LINE_NUMBERING,
                                Boolean.TRUE);
                    } else if (option.equals("TP")) {
                        i++;
                        TraceListener traceListener = new org.pdf4j.saxon.trace.TimedTraceListener();
                        factory.setAttribute(FeatureKeys.TRACE_LISTENER,
                                traceListener);
                        factory.setAttribute(FeatureKeys.LINE_NUMBERING,
                                Boolean.TRUE);
                    } else if (option.equals("traceout")) {
View Full Code Here

TOP

Related Classes of org.pdf4j.saxon.trace.TraceListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.