/** * Get the context stack. This method returns an iterator whose items are instances of * {@link net.sf.saxon.trace.ContextStackFrame}, starting with the top-most stackframe and * ending at the point the query or transformation was invoked by a calling application. * * @return an iterator over a copy of the run-time call stack */ public Iterator iterateStackFrames() { return new ContextStackIterator(this); }
/** * Create an iterator over the stack of XPath dynamic context objects, starting with the top-most * stackframe and working down. The objects returned by this iterator will be of class {@link ContextStackFrame}. * Note that only "major" context objects are considered - those that have a stack frame of their own. * * @param context the current context */ public ContextStackIterator(XPathContext context) { if (!(context instanceof XPathContextMajor)) { context = getMajorCaller(context); } next = (XPathContextMajor) context; }
next = getMajorCaller(context); return new ContextStackFrame.CallingApplication(); } else if (origin instanceof BuiltInRuleSet) { next = getMajorCaller(context); return new ContextStackFrame.BuiltInTemplateRule(context); } else if (origin instanceof UserFunction) { sf.setFunctionName(ufc.getFunctionName()); sf.setContextItem(context.getContextItem()); next = getMajorCaller(context); return sf; } else if (origin instanceof UserFunctionCall) { sf.setFunctionName(ufc.getFunctionName()); sf.setContextItem(context.getContextItem()); next = getMajorCaller(context); return sf; } else if (origin instanceof ApplyTemplates) { sf.setLocation(loc.getLocation()); sf.setContextItem(context.getContextItem()); next = getMajorCaller(context); return sf; } else if (origin instanceof CallTemplate) { sf.setTemplateName(loc.getObjectName()); sf.setContextItem(context.getContextItem()); next = getMajorCaller(context); return sf;
return next();
next = getMajorCaller(context); return new ContextStackFrame.CallingApplication(); } else if (origin instanceof BuiltInRuleSet) { next = getMajorCaller(context); return new ContextStackFrame.BuiltInTemplateRule(context); } else if (origin instanceof UserFunction) { sf.setContextItem(context.getContextItem()); sf.setContext(context); next = getMajorCaller(context); return sf; } else if (origin instanceof UserFunctionCall) { sf.setContextItem(context.getContextItem()); sf.setContext(context); next = getMajorCaller(context); return sf; } else if (origin instanceof ApplyTemplates) { sf.setContextItem(context.getContextItem()); sf.setContext(context); next = getMajorCaller(context); return sf; } else if (origin instanceof CallTemplate) { sf.setContextItem(context.getContextItem()); sf.setContext(context); next = getMajorCaller(context); return sf;
/** * Get the context stack. This method returns an iterator whose items are instances of * {@link net.sf.saxon.trace.ContextStackFrame}, starting with the top-most stackframe and * ending at the point the query or transformation was invoked by a calling application. * * @return an iterator over a copy of the run-time call stack */ public Iterator iterateStackFrames() { return new ContextStackIterator(this); }
/** * Create an iterator over the stack of XPath dynamic context objects, starting with the top-most * stackframe and working down. The objects returned by this iterator will be of class {@link ContextStackFrame}. * Note that only "major" context objects are considered - those that have a stack frame of their own. * * @param context the current context */ public ContextStackIterator(XPathContext context) { if (!(context instanceof XPathContextMajor)) { context = getMajorCaller(context); } next = (XPathContextMajor) context; }
/** * Get the context stack. This method returns an iterator whose items are instances of * {@link net.sf.saxon.trace.ContextStackFrame}, starting with the top-most stackframe and * ending at the point the query or transformation was invoked by a calling application. * * @return an iterator over a copy of the run-time call stack */ public Iterator iterateStackFrames() { return new ContextStackIterator(this); }
/** * Print a stack trace to a specified output destination * * @param out the print stream to which the stack trace will be output * @param context the XPath dynamic execution context (which holds the head of a linked * list of context objects, representing the execution stack) */ public static void printStackTrace(Logger out, XPathContext context) { Iterator<ContextStackFrame> iterator = new ContextStackIterator(context); while (iterator.hasNext()) { ContextStackFrame frame = iterator.next(); frame.print(out); } }
/** * Print a stack trace to a specified output destination * @param out the print stream to which the stack trace will be output * @param context the XPath dynamic execution context (which holds the head of a linked * list of context objects, representing the execution stack) */ public static void printStackTrace(PrintStream out, XPathContext context) { Iterator iterator = new ContextStackIterator(context); while (iterator.hasNext()) { ContextStackFrame frame = (ContextStackFrame)iterator.next(); if (frame == null) { break; } frame.print(out); } }
XPathContext ctxt = xe.getXPathContext(); if (ctxt != null) { Iterator<ContextStackFrame> ff = new ContextStackIterator(xe.getXPathContext()); while (ff.hasNext()) { ContextStackFrame f = ff.next();