RE: [xsl] java.lang.OutOfMemory Error When Transforming a Flat XML Document into Detailed XML Document via XSL

Subject: RE: [xsl] java.lang.OutOfMemory Error When Transforming a Flat XML Document into Detailed XML Document via XSL
From: "David Haines" <david.f.haines@xxxxxxxx>
Date: Wed, 14 Nov 2001 07:56:48 -0600
I am using xerces and xalan.  When you refer to a SAX pipeline, do you mean
manually parse each <ROW> tag?  Is there no way to transform one <ROW> tag
at a time via XSL using SAX?

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
Sent: Tuesday, November 13, 2001 4:22 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] java.lang.OutOfMemory Error When Transforming a Flat
XML Document into Detailed XML Document via XSL


Since this appears to be a completely serial process, and since you are
already writing Java code, it would be much better done as a SAX pipeline.
To process a 22MB file in XSLT you need a lot of memory (though you didn't
say which processor you are using).

The other thing you might look at is the <saxon:preview> extension, which
allows you to process a large file "one subtree at a time".

Mike Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> David Haines
> Sent: 13 November 2001 22:08
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] java.lang.OutOfMemory Error When Transforming
> a Flat XML
> Document into Detailed XML Document via XSL
>
>
> We are developing a process that converts a fixed-length flat
> file into XML.
> As of this point, I have performed the following steps via
> Java and XSL:
>
> 1. Created a Java class to take a flat file and create a flat
> XML file. For
> instance, the flat XML file would look like:
>
> <ROWSET>
> <ROW>flat file record 1</ROW>
> <ROW>flat file record 2</ROW>
> ...
> </ROWSET>
>
> 2. Created an XSL stylesheet that would create a detailed XML
> document (see
> below) based on the flat XML file.
>
> <ROWSET>
> <ROW>
> <RECORD_ID>0342323</RECORD_ID>
> <SUBMISSION_DATE>03/22/2001</SUBMISSION_DATE>
> </ROW>
> <ROW>
> <RECORD_ID>0342324</RECORD_ID>
> <SUBMISSION_DATE>03/23/2001</SUBMISSION_DATE>
> </ROW>
> </ROWSET>
>
> 3. Created a Java class to take the Flat XML file in (1) and
> transform it to
> full XML based on the XSL document in (2).
>
> public void convert() {
> try {
> javax.xml.transform.TransformerFactory tFactory =
> javax.xml.transform.TransformerFactory.newInstance();
> javax.xml.transform.Transformer transformer =
> tFactory.newTransformer(new
> javax.xml.transform.stream.StreamSource(xslDoc));
> transformer.transform(new
> javax.xml.transform.stream.StreamSource(inXML),
> new javax.xml.transform.stream.StreamResult(
> new java.io.FileOutputStream(outXML)));
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
> 4. When I run execute this Java class using a large file
> (e.g., 22 Mb), it
> will process until it hits a java.lang.OutOfMemory error.
> Mind you that it
> creates approximately half its task of creating of the full
> XML document
> before hitting the OutOfMemory error.
>
> Any thoughts on how to process large files using XSL transformation?
>
>
> David Haines
> david.f.haines@xxxxxxxx
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread