* system use the default.
* Targets that do not need an OutputStream should set that parameter
* to null.
*/
final LayoutStrategy layout = new PioneerLS(session.getLogger());
final FOrayTarget target = new FOrayTarget(document, outputTarget,
layout, outputStream);
/*
* Everything is now ready to go. There are two different processing
* models possible here. The first is to let FOray manage and
* complete the processing internally. The second is to manage that
* process externally, e.g. those integrating with Cocoon or another
* pipeline-type scheme. If you don't know which of those to use, you
* should probably let FOray control the processing. The instructions
* are separated below for the two models. IMPORTANT: Please note that
* the instructions reunify below for some cleanup code that is common
* to both.
*/
/* *****************************************************************************
* Start instructions for internal FOray control. Ignore this section
* if you are controlling externally.
* ****************************************************************************/
/*
* Just push the button, and let FOray do the rest ...
*/
session.process();
/* *****************************************************************************
* End instructions for internal FOray control.
* ****************************************************************************/
/* *****************************************************************************
* Start instructions for external control. Ignore this section if
* FOray is controlling the processing internally.
* ****************************************************************************/
/*
* The task here is to mimic the internal FOray processing, but to do
* it outside of FOray. The processing that needs to be duplicated can
* be found at the FOrayDocument method processTarget(FOrayTarget
* target). This is the method ultimately called from the FOraySession
* method process(), documented above as the button to push for
* internal FOray processing. The commented code below is the outline
* of the steps that need to be taken:
*/
/*
document.setTarget(target);
// Get either a SAX ContentHandler ...
ContentHandler contentHandler = document.getContentHandler();
// ... or a JAXP SAXResult
SAXResult jaxpResult = document.getJAXPResult();
// Do something with contentHandler or JAXP SaxResult here.
MyClass.myMethod(contentHandler);
// Allow the document to do some cleanup.
document.cleanup(target);
*/
/* *****************************************************************************
* End instructions for external control.
* ****************************************************************************/
/* *****************************************************************************
* Start instructions for common cleanup code.
* ****************************************************************************/
/*
* The process of closing the OutputStream is handled here instead of
* internally within FOray so that those who wish to do something else
* with it can.
*/
target.cleanup();
}