Subject: RE: [xsl] Chaining Transformers/Templates From: "Varley, Roger" <Roger.Varley@xxxxxxxxxxx> Date: Tue, 10 Dec 2002 13:00:54 -0000 |
> > > The reason that I want to to use Templates is that I > > will have a large number of threads performing a > > transormations using two standard XSL stylesheets so I want > > to avoid the overhead of re-processing the transform > > instructions every time. Thanks to Micheal Kays response I now have the following code running and working in the processing threads. TransformerFactory tFactory = TransformerFactory.newInstance(); SAXTransformerFactory saxFactory = (SAXTransformerFactory) tFactory; TransformerHandler standardTH = saxFactory.newTransformerHandler(standardTemplate); TransformerHandler recipientTH = saxFactory.newTransformerHandler(recipientTemplate); XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setContentHandler(standardTH); standardTH.setResult(new SAXResult(recipientTH)); Serializer serializer = SerializerFactory.getSerializer(OutputProperties.getDefaultMethodProperties( "xml")); serializer.setOutputStream(new FileOutputStream(incomingPath + "result.xml")); recipientTH.setResult(new SAXResult(serializer.asContentHandler())); The template objects are created by an external singleton class called by the processing thread. The singleton class has to call TransformerFactory.newInstance() to create the template, so I'm now wondering how much of the above code I can move to my external singleton class and still remain threadsafe. For example, could I go as far as moving all this code to my external class so that the XMLReader is only built once and return the XMLReader object to every thread that asks for it. The thread then builds the input for the XMLReader and then calls XMLReader.parse(). Regards Roger XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Chaining Transformers/Tem, Varley, Roger | Thread | RE: [xsl] Chaining Transformers/Tem, Michael Kay |
RE: [xsl] Chaining Transformers/Tem, Varley, Roger | Date | [xsl] transforming xml to xhtml, True Name |
Month |