Ignore the question below - it works (if anyone needs SAX example, this
is decent).

It looks like what is happening is that I was writing this directly to a
servlet's outputstream, so I never set the content length header. This
made IE puke, although Lynx caught it ok. I've read through the threads
about how IE handles content length header and requests the document
twice.

Is there any alternative to writing to a byte array to calculate the
length before rewriting to the servlet's output stream? I'd like to
avoid the memory consequences.

Thanks,
Brian



-----Original Message-----
From: Brian O'Kelley [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 15, 2002 5:28 PM
To: [EMAIL PROTECTED]
Subject: FOP and SAX


I'm trying to take an XML document, combine it with an XSL stylesheet,
and spit it to PDF using SAX events, and I'm having trouble finding an
example that works.

Here's my code (using Fop 0.20.3):

        TransformerHandler tHandler = XSLTranslateFactory.
                getHandler("FopInput.xsl") ; // gets TransformerHandler
from this file
        Driver fopDriver = new Driver() ;
        fopDriver.setRenderer(Driver.RENDER_PDF) ;
        fopDriver.setOutputStream(out) ;
        ContentHandler cHandler = driver.getContentHandler() ;

        XMLReader reader = XMLReaderFactory.createXMLReader() ;
        reader.setContentHandler(tHandler) ;
 
reader.setProperty("http://xml.org/sax/properties/lexical-handler";,
                tHandler) ;
        tHandler.setResult(new SAXResult(cHandler)) ;
        reader.parse(source) ;

Any ideas?

Thanks,
Brian


Reply via email to