[jdom-interest] Compression and JDOM

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu Sep 20 09:42:52 PDT 2001

David Morris wrote:

> Group,
> We have run into a scalability issue while creating a XSL-FO document. 
> The volume of data required to describe a simple columnar report makes 
> it impossible for us to use transform documents like we want. For example, 
> when the JDOM tree for a 70 page report is serialized it takes about 250M. 
> I am looking for suggestions on how we can reduce the size of our output 
> passed to FOP, the tags, etc. are highly redundant and would seem to be 
> a good candidate for compression.

As you do not describe how you pass information to FOP, it's quite hard to 
give an answer. But...
What you can do to reduce the size of the XSL-FO document is to use the 
shortest possible prefix for XSL-FO either by making XSL-FO namespace the 
default or by using a one-character prefix.

Have you considered using a SAX pipeline so that the whole process happens in 
memory: JDOM -> XSL-FO -> FOP? The preferred XML input for FOP is SAX (except 
for FOP 0.20.x which is has a show-stopper bug when not parsing from an XML 
text stream).
Using the TrAX API to transform a JDOM document into an XSL-FO document and 
FOP 0.19 to render it in PDF, your code can be as simple as:

       // Allocate and configure a new driver instance.
       Driver driver = new Driver();

       driver.setOutputStream(new BufferedOutputStream(out));

       // Apply XSL Transformation redirecting the
       // result to the FOP rendering engine.
			new JDOMSource(doc),
			new SAXResult(driver.getContentHandler()));

       // Render PDF document

Hope this helps,


More information about the jdom-interest mailing list