• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

OutOfMemory (the correct one).

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Wim Lambrecht
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do i need a SAXTransformerFactory instead of a TransformerFactory then ?
TIA. wil.
 
Christophe Grosjean
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Wim Lambrecht
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A quick reply: with a smaller document it works perfect. I will reply later on ...
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic