/** * 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) { 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) { 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); }
/** * 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 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); } }