/** * Explain the results of query compilation * * @param exp the compiled expression * @throws FileNotFoundException if the destination for the explanation doesn't exist * @throws XPathException if other failures occur */ protected void explain(XQueryExpression exp) throws FileNotFoundException, XPathException { OutputStream explainOutput; if (explainOutputFileName == null) { explainOutput = System.err; } else { explainOutput = new FileOutputStream(new File(explainOutputFileName)); } Properties props = new Properties(); props.setProperty(OutputKeys.METHOD, "xml"); props.setProperty(OutputKeys.INDENT, "yes"); props.setProperty(SaxonOutputKeys.INDENT_SPACES, "2"); Receiver diag = config.getSerializerFactory().getReceiver( new StreamResult(explainOutput), config.makePipelineConfiguration(), props); ExpressionPresenter expressionPresenter = new ExpressionPresenter(config, diag); exp.explain(expressionPresenter); }
/** * Explain the results of query compilation * * @param exp the compiled expression * @throws FileNotFoundException if the destination for the explanation doesn't exist * @throws XPathException if other failures occur */ protected void explain(XQueryExpression exp) throws FileNotFoundException, XPathException { OutputStream explainOutput; if (explainOutputFileName == null || "".equals(explainOutputFileName)) { explainOutput = System.err; } else { explainOutput = new FileOutputStream(new File(explainOutputFileName)); } SerializationProperties props = ExpressionPresenter.makeDefaultProperties(config); Receiver diag = config.getSerializerFactory().getReceiver( new StreamResult(explainOutput), props); ExpressionPresenter expressionPresenter = new ExpressionPresenter(config, diag); exp.explain(expressionPresenter); }
/** * Explain the results of query compilation * * @param exp the compiled expression * @throws FileNotFoundException if the destination for the explanation doesn't exist * @throws XPathException if other failures occur */ protected void explain(XQueryExpression exp) throws FileNotFoundException, XPathException { OutputStream explainOutput; if (explainOutputFileName == null || "".equals(explainOutputFileName)) { explainOutput = System.err; } else { explainOutput = new FileOutputStream(new File(explainOutputFileName)); } SerializationProperties props = ExpressionPresenter.makeDefaultProperties(config); Receiver diag = config.getSerializerFactory().getReceiver( new StreamResult(explainOutput), props); ExpressionPresenter expressionPresenter = new ExpressionPresenter(config, diag); exp.explain(expressionPresenter); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. * @param level this argument is ignored * @param out the expression presenter used to display the structure * @param config the Saxon configuration * @deprecated since 9.0 - use the explain method */ public void display(int level, PrintStream out, Configuration config) { try { ExpressionPresenter ep = new ExpressionPresenter(config, ExpressionPresenter.defaultDestination(config, out)); explain(ep); } catch (XPathException err) { // ignore the exception } }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. * @param level this argument is ignored * @param out the expression presenter used to display the structure * @param config the Saxon configuration * @deprecated since 9.0 - use the explain method */ public void display(int level, PrintStream out, Configuration config) { try { ExpressionPresenter ep = new ExpressionPresenter(config, ExpressionPresenter.defaultDestination(config, out)); explain(ep); } catch (XPathException err) { // ignore the exception } }
/** * Explain the results of query compilation * * @param exp the compiled expression * @throws FileNotFoundException if the destination for the explanation doesn't exist * @throws XPathException if other failures occur */ protected void explain(XQueryExpression exp) throws FileNotFoundException, XPathException { OutputStream explainOutput; if (explainOutputFileName == null) { explainOutput = System.err; } else { explainOutput = new FileOutputStream(new File(explainOutputFileName)); } Properties props = new Properties(); props.setProperty(OutputKeys.METHOD, "xml"); props.setProperty(OutputKeys.INDENT, "yes"); props.setProperty(SaxonOutputKeys.INDENT_SPACES, "2"); Receiver diag = config.getSerializerFactory().getReceiver( new StreamResult(explainOutput), config.makePipelineConfiguration(), props); ExpressionPresenter expressionPresenter = new ExpressionPresenter(config, diag); exp.explain(expressionPresenter); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied outputstream. * @param out the expression presenter used to display the structure */ public final void explain(OutputStream out) { ExpressionPresenter ep = new ExpressionPresenter(getExecutable().getConfiguration(), out); explain(ep); ep.close(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied outputstream. * @param out the expression presenter used to display the structure */ public final void explain(OutputStream out) { ExpressionPresenter ep = new ExpressionPresenter(getExecutable().getConfiguration(), out); explain(ep); ep.close(); }
/** * Produce a diagnostic representation of the compiled stylesheet, in XML form. * <p><i>The detailed form of this representation is not stable (or even documented).</i></p> * * @param destination the destination for the XML document containing the diagnostic representation * of the compiled stylesheet * @since 9.1 */ public void explain(Destination destination) throws SaxonApiException { Configuration config = processor.getUnderlyingConfiguration(); try { Receiver out = destination.getReceiver(config.makePipelineConfiguration(), config.obtainDefaultSerializationProperties()); preparedStylesheet.explain(new ExpressionPresenter(config, out)); } catch (XPathException e) { throw new SaxonApiException(e); } }
/** * Produce a diagnostic representation of the compiled query, in XML form. * <p><i>The detailed form of this representation is not stable (or even documented).</i></p> * * @param destination the destination for the XML document containing the diagnostic representation * of the compiled stylesheet * @since 9.6 */ public void explain(Destination destination) throws SaxonApiException { Configuration config = processor.getUnderlyingConfiguration(); try { PipelineConfiguration pipe = config.makePipelineConfiguration(); exp.explain(new ExpressionPresenter(config, destination.getReceiver(pipe, config.obtainDefaultSerializationProperties()))); } catch (XPathException e) { throw new SaxonApiException(e); } }
/** * Produce a diagnostic representation of the compiled stylesheet, in XML form. * <p><i>The detailed form of this representation is not stable (or even documented).</i></p> * * @param destination the destination for the XML document containing the diagnostic representation * of the compiled stylesheet * @since 9.1 */ public void explain(Destination destination) throws SaxonApiException { Configuration config = processor.getUnderlyingConfiguration(); try { Receiver out = destination.getReceiver(config.makePipelineConfiguration(), config.obtainDefaultSerializationProperties()); preparedStylesheet.explain(new ExpressionPresenter(config, out)); } catch (XPathException e) { throw new SaxonApiException(e); } }
/** * Produce a diagnostic representation of the compiled query, in XML form. * <p><i>The detailed form of this representation is not stable (or even documented).</i></p> * * @param destination the destination for the XML document containing the diagnostic representation * of the compiled stylesheet * @since 9.6 */ public void explain(Destination destination) throws SaxonApiException { Configuration config = processor.getUnderlyingConfiguration(); try { PipelineConfiguration pipe = config.makePipelineConfiguration(); exp.explain(new ExpressionPresenter(config, destination.getReceiver(pipe, config.obtainDefaultSerializationProperties()))); } catch (XPathException e) { throw new SaxonApiException(e); } }
config.makePipelineConfiguration(), props); ExpressionPresenter expressionPresenter = new ExpressionPresenter(config, diag); sheet.explain(expressionPresenter); expressionPresenter.close();
config.makePipelineConfiguration(), props); ExpressionPresenter expressionPresenter = new ExpressionPresenter(config, diag); sheet.explain(expressionPresenter); expressionPresenter.close();
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied outputstream. * * @param out the expression presenter used to display the structure */ public final void explain(Logger out) { ExpressionPresenter ep = new ExpressionPresenter(getConfiguration(), out); try { export(ep); } catch (XPathException e) { ep.startElement("failure"); ep.emitAttribute("message", e.getMessage()); ep.endElement(); } ep.close(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied outputstream. * * @param out the expression presenter used to display the structure */ public final void explain(Logger out) { ExpressionPresenter ep = new ExpressionPresenter(getConfiguration(), out); ExpressionPresenter.ExportOptions options = new ExpressionPresenter.ExportOptions(); options.explaining = true; ep.setOptions(options); try { export(ep); } catch (XPathException e) { ep.startElement("failure"); ep.emitAttribute("message", e.getMessage()); ep.endElement(); } ep.close(); }