This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: 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@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
> David Haines
> Sent: 13 November 2001 22:08
> To: XSL-List@lists.mulberrytech.com
> 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@home.com
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]