/** * Show the location of a call (for use by subclasses) * * @return typically "(" + systemId() + "#" + lineNumber() + ")" */ protected String showLocation() { if (getSystemId() == null) { return ""; } int line = getLineNumber(); if (line == -1 || line == 0xfffff) { return "(" + getSystemId() + ")"; } else { return "(" + getSystemId() + "#" + getLineNumber() + ")"; } }
/** * 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); } }
private static String getInstructionName(ContextStackFrame frame) { if (frame instanceof ContextStackFrame.FunctionCall) { StructuredQName name = ((ContextStackFrame.FunctionCall)frame).getFunctionName(); if (name != null) return name.getClarkName() + "()"; } else if (frame instanceof ContextStackFrame.ApplyTemplates) { String name = "xsl:apply-templates"; Item node = frame.getContextItem(); if (node instanceof NodeInfo) name += " processing " + Navigator.getPath((NodeInfo)node); return name; } else if (frame instanceof ContextStackFrame.CallTemplate) { return "xsl:call-template name=\"" + ((ContextStackFrame.CallTemplate)frame).getTemplateName().getDisplayName() + "\""; } else if (frame instanceof ContextStackFrame.VariableEvaluation) { Object container = frame.getContainer(); if (container instanceof Actor) { return getInstructionName((Actor)container); } else if (container instanceof TemplateRule) { return "xsl:template match=\"" + ((TemplateRule)container).getMatchPattern().toString() + "\""; } } return null; }
/** * 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); } }
/** * Show the location of a call (for use by subclasses) * * @return typically "(" + systemId() + "#" + lineNumber() + ")" */ protected String showLocation() { if (getSystemId() == null) { return ""; } int line = getLineNumber(); if (line == -1 || line == 0xfffff) { return "(" + getSystemId() + ")"; } else { return "(" + getSystemId() + "#" + getLineNumber() + ")"; } }
instructionName = getInstructionName(f); if (instructionName != null) frames.add(XProcException.prettyLocator(f.getSystemId(), f.getLineNumber(), instructionName));