You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Christopher Giblin <CG...@zurich.ibm.com> on 2002/10/16 20:27:46 UTC

q on using SAXTransformer and memory usage




Hi
I think this has been asked many times, but here goes:

Will I immediately experience better memory utilization by explicitly using
SAX as described in http://xml.apache.org/xalan-j/usagepatterns.html#sax ?
My xml documents are very large - 50k-200k and I see quite a memory
expansion after transforming about 500 such docs.
FYI, I cache Templates instances, so the XSL is compiled once.

As basis for comparison, consider a FileReader and a FileWriter being
passed to this method using Streams:

      public static void transform(Reader xmlSource,
                                   Transformer transformer,
                                   Writer target)
            throws TransformerException {

            transformer.transform(new StreamSource(xmlSource),
                                  new StreamResult(target));

      }


By reimplementing using SAXTransformerFactory/TemplatesHandler/XMLReader et
al, will I notice an immediate difference?

I guess I am asking how StreamSource/Streamresult is implemented in Xalan-J
- also SAX based under the covers ?
Is a DTM produced likewise  when using SAXTransformer, potentially
relativizing any expected "big gain"?

Any tip or reference appreciated.

Thanks, chris