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]

java.lang.OutOfMemory Error When Transforming a Flat XML Document into Detailed XML Document via XSL

[Get raw message]
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


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