I'm sorry, Jay, but that's not much better than a temporary file. What you do here is serialize the generated XSL-FO to an XML file and then parse it back from memory. The only difference is that the temporary file is not written to disk but is kept in memory.
If you want to build an efficient data flow, please study the examples here: http://xmlgraphics.apache.org/fop/latest/embedding.html#examples It's a step-by-step guide that shows how to link multiple transformation steps together using SAX. Using SAX you can avoid serialization and reparsing of the intermediate products. The output of the previous step is fed directly into the next step. On 11.05.2006 23:46:16 Jay Bryant wrote: > > I have the servlet working to create a PDF from an object list created > from > > our database. I am writing the .xml to a file and them reading it back in > > which seems counterproductive. > > Is there a way to create the PDF on the fly without writing the xml to a > > file first. > > Thanks > > Calvn > > Write the results into an output stream. Then convert the output stream into > an input stream and convert that into PDF. > > I wrote a servlet to take the output from Saxon and turn it into input for > FOP. Here's the relevant chunk: > > // Here's where the output from Saxon becomes the input for FOP. > ByteArrayOutputStream transformResult = transformXML(transform, source, > req, res); > if (transformResult.size() == 0) > { > res.getOutputStream().println("Transform produced no output"); > } > else > { > ByteArrayInputStream transformStream = new > ByteArrayInputStream(transformResult.toByteArray()); > makePDF(transformStream, res); > } Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
