• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Migrate from JDOM to SAX??

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I need a bit of advice on an application I have that reads in an XML file and based on its content generates a text file which is used by another application.
I have written my application to handle the XML file using JDOM. So when the XML file is read in it creates a JDOM Document which I then use to access the Elements I need to create the text file. However I have now run into some memory problems and am questioning the wisdom of using JDOM. The XML files I have to handle are much bigger then I had anticipated (they are around 1MB) and as a result I was getting OutOfMemory Exceptions when executing my application. I have had to increase the Java heap size to 400 MB to get my application to execute successfully. I have watched the memory usage of the application while it is running and it hits 393MB. This seems a bit crazy. Should I definately migrate my code to use the SAX API??
Also as an aside, if I had to deal with an even larger XML file which required me to increase the Heap size to greater than 400MB whats the max size that I could set the heap given that my machine has 522MB of RAM??
Thanks for your help...
John
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Should I definately migrate my code to use the SAX API??


I would say yes. I faced the problem in weblogic 6.0 server. My parser code using DOM worked fine as a standalone but when I used it in weblogic server the parser crashed saying -"Reduce the file size". I had to migrate to SAX. The DOM part will work fine for smaller XML documents but as the doc becomes bigger the trouble starts.
 
reply
    Bookmark Topic Watch Topic
  • New Topic