This code works : SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); SAXParser parser = factory.newSAXParser(); Transformer transformer = getXSLTTransform("/ scheda.xslt"); transformer.transform( new SAXSource(parser.getXMLReader(), new InputSource(url.openStream())), new StreamResult(pageContext.getOut()));
So do you think that using dom4j to only transform a document it's not efficent ? The transform source isn't using some dom-like internal rapresentation of the XML ? Thank you Il giorno 21/giu/07, alle ore 10:55, Edwin Dankert ha scritto: > Because you are not manipulating the dom4j document programatically, > I wouldn't use dom4j for this task. > > You are performing the following tasks: > - create an input dom4j document from an input-stream, > - transform the document, (might make another DOM) > - into a resulting dom4j document, > - write the resulting dom4j document. > > Without doing any performance tests, this does not seem to be > particularly efficient. > > Instead the following would maybe be better: > - transform the input-stream, (makes a DOM internally) > - write the result while transforming. > > The following code is not tested: > > SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); > Transformer transformer = > TransformerFactory.newInstance().newTransformer(new > StreamSource("/scheda.xslt")); > transformer.setOutputProperty("method", "html"); > transformer.transform( > new SAXSource(parser.getXMLReader(), new InputSource(url)), > new StreamResult(pageContext.getOut())); > > This only creates (at most) one document in memory and writes the > results > directly to the writer. For even less memory use, please check out > Saxon tinytree mechanism: http://saxon.sourceforge.net/ > > Regards, > Edwin > -- > http://www.edankert.com/ -- Ing. Andrea Vettori Consulente per l'Information Technology ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user