Hi, We get an OutOfMemoryException during the run of the code at the bottom of this message. The XML-file to parse is about 72M big. After 30 sec it runs out of memory. Maybe it has something to do with the parser Xalan vs. Xerces ... Any ideas ? TIA wil
EDIT: I took the privilege of adding CODE tags for your code snippet and removed the duplicate post. [ October 06, 2003: Message edited by: Lasse Koskela ]
I may be wrong but : 72M is quite huge... The transformation requires the building of a DOM-like structure of the XML (in Xalan, I think that they have a "light" implementation of DOM), so it takes memory ! If your XSL is simple, perhaps a solution is to parse your XML with SAX and to output the content in your text file (doing the XSL job in the java code instead). Christophe
No. In fact, what I'm suggesting is to avoid using Transformer and XSL. Perhaps you can do the transformation by yourself by : 1) parse the XML input file with a SAX parser 2) sets to the SAX parser an XMLFilter as ContentHandler 3) sets an XMLWriter as the parent for the XMLFilter 4) The XMLFilter set in (2) must be a subclass of XMLFitlerImpl in which the event methods have been overriden (do specific job that was in your XSL, for instance in the startElement()). But : * this works if your output format is XML * if not (HTML, text...) do not use XMLFilter and XMLWriter, but simply create an implementation of ContentHandler directly writing the output data in a File. Questions : * Did you try your transformation with a smaller version of your document ? Was it working ? * Is your transformation complex ? An example ? Christophe
Joined: Jun 26, 2003
A quick reply: with a smaller document it works perfect. I will reply later on ...