parser.parse(src, treeModel, userAgent);
treeModel.endDocument();
}
private Document parseAndRenderToAreaTree(Source src) throws Exception {
AreaTreeParser parser = new AreaTreeParser();
//Set up XMLRenderer to render to a DOM
TransformerHandler handler = tFactory.newTransformerHandler();
DOMResult domResult = new DOMResult();
handler.setResult(domResult);
XMLRenderer renderer = new XMLRenderer();
renderer.setContentHandler(handler);
FOUserAgent userAgent = createUserAgent();
userAgent.setRendererOverride(renderer);
renderer.setUserAgent(userAgent);
FontInfo fontInfo = new FontInfo();
AreaTreeModel treeModel = new RenderPagesModel(userAgent,
MimeConstants.MIME_FOP_AREA_TREE, fontInfo, null);
parser.parse(src, treeModel, userAgent);
treeModel.endDocument();
return (Document)domResult.getNode();
}