// Factory to create dissection WBDOM nodes.
DissectableWBDOMFactory dissectionFactory =
new DissectableWBDOMFactory(wmlConfiguration);
// Handler to parse WBSAX events into WBDOM nodes.
WBSAXParser parser = new DissectionWBSAXParser(dissectionFactory,
wmlConfiguration);
StringWriter out = null;
try {
if (logger.isDebugEnabled()) {
out = new StringWriter();
handler = new WBSAXDisassembler(parser, out);
} else {
handler = parser;
}
// Plugin optimiser
optimiser = new URLOptimiser(handler);
optimiser.setPageContext(getMarinerPageContext());
if (logger.isDebugEnabled()) {
out = new StringWriter();
filter = new WBSAXDisassembler(optimiser, out);
} else {
filter = optimiser;
}
processorContext.setContentHandler(filter);
wbsaxOutputter.output(document);
} finally {
if (logger.isDebugEnabled()) {
out.flush();
logger.debug(out);
}
}
try {
if (logger.isDebugEnabled()) {
out = new StringWriter();
handler = new WBSAXDisassembler(producer, out);
} else {
handler = producer;
}
super.writeViaDissection(
new WBDOMDissectableDocument(parser.getDocument()),
new WBDOMDissectedContentHandler(handler, wmlConfiguration, urlListener));
} finally {
if (logger.isDebugEnabled()) {
out.flush();