Return-Path: Delivered-To: apmail-xml-fop-user-archive@xml.apache.org Received: (qmail 4555 invoked by uid 500); 1 May 2003 17:51:53 -0000 Mailing-List: contact fop-user-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: fop-user@xml.apache.org Delivered-To: mailing list fop-user@xml.apache.org Received: (qmail 4544 invoked from network); 1 May 2003 17:51:53 -0000 Received: from client-151-198-243-110.qdx-it.com (HELO tbrws0037.us.qdx.com) (151.198.243.110) by daedalus.apache.org with SMTP; 1 May 2003 17:51:53 -0000 Received: from 156.30.64.24 by tbrws0037.us.qdx.com with SMTP ( Tumbleweed MMS SMTP Relay (MMS v5.5.0)); Thu, 01 May 2003 13:55:01 -0400 Received: FROM tbrws0043.us.qdx.com BY tbcwp72.qdx.com ; Thu May 01 13: 51:08 2003 -0400 Received: from QDCWS0043.us.qdx.com ([156.30.224.43]) by tbrws0043.us.qdx.com with Microsoft SMTPSVC(5.0.2195.5329); Thu, 1 May 2003 13:54:33 -0400 content-class: urn:content-classes:message Subject: RE: Seeking advice on HSSF Date: Thu, 1 May 2003 13:50:59 -0400 Message-ID: <4B4BB815EBADD411AD000090274F060C03716EE9@sjhwmis2.metpath.com> MIME-Version: 1.0 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Seeking advice on HSSF Thread-Index: AcMQCFgl/3+W2XkkQB6JvHlqVvs4rwAAB0Ag X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 From: "Savino, Matt C" To: fop-user@xml.apache.org X-OriginalArrivalTime: 01 May 2003 17:54:33.0425 (UTC) FILETIME=[B8E52C10:01C3100A] X-WSS-ID: 12AF80FF594145-01-01 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Thanks Jeremias. I think the main reason we are parsing the fodoc into a = DOM is so we can serialize the FO out to a file for debugging (it's = either that or do the transformation twice). I'm actually in the process = of altering the HSSF stuff now so I can debug the GMR output. On your = adive I will change both of them back to a stream source for production. = Although I seem to remember experimenting extensively when we first = started with SAX vs. DOM input sources using the FOP XSLTInputHandler, = SAXHandler, etc. As I recall, we didn't see much difference in = performance. But I will try it again for this round and let you know how = it goes. Actually here is the old commented out code from these tests: File xmlFile =3D new File(xmlFilename); File xsltFile =3D new File(xsltFilename); org.apache.fop.apps.InputHandler inputHandler2 =3D new = org.apache.fop.apps.XSLTInputHandler(xmlFile, xsltFile); org.xml.sax.XMLReader parser2 =3D inputHandler2.getParser(); driver.render(parser2, inputHandler2.getInputSource()); Is there a more efficient method I should try? thx, Matt > > org.w3c.dom.Document xmlDoc =3D dBuilder.parse(xmlFile); > > javax.xml.transform.dom.DOMSource xmlDomSource =3D new=20 > javax.xml.transform.dom.DOMSource(xmlDoc); > >=20 > > org.w3c.dom.Document xslDoc =3D dBuilder.parse(xsltFile); > > javax.xml.transform.dom.DOMSource xslDomSource =3D new=20 > javax.xml.transform.dom.DOMSource(xslDoc); >=20 > Why do you parse the whole thing into a DOM? That's very inefficient > when you subsequently give it to JAXP anyway. A StreamSource=20 > would be a > lot better! >=20 > Have a look at the Example*.java in the latest FOP distribution under > examples/embedding. >=20 > >=20 > > javax.xml.transform.TransformerFactory tFactory=20 > > =3D javax.xml.transform.TransformerFactory.newInstance(); > > javax.xml.transform.Templates templates =3D=20 > tFactory.newTemplates(xslDomSource); > > javax.xml.transform.Transformer transformer =3D=20 > templates.newTransformer(); > > =20 > > ByteArrayOutputStream out =3D new ByteArrayOutputStream(); > >=20 > > org.w3c.dom.Document foDoc =3D=20 > (org.w3c.dom.Document)domResult.getNode(); >=20 > Again, don't do that. Use SAX as with the HSSF serializer: >=20 > Result result =3D new SAXResult(driver.getContentHandler()); > transformer.transform(xml, result); > =20 > See how similar the code is to the one for HSSF? >=20 > > org.apache.fop.apps.Driver driver =3D new=20 > org.apache.fop.apps.Driver(); > > driver.setErrorDump(true); > > driver.setRenderer(driver.RENDER_PDF); > > driver.setupDefaultMappings() ; > > driver.setOutputStream(out); > > driver.render(foDoc); > >=20 > > response.setContentType("application/pdf"); --------------------------------------------------------------------- To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org For additional commands, e-mail: fop-user-help@xml.apache.org