• 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

Classes for XML Building

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have written a program for creating XML documents which uses the Document and DOM classes. The problem I face is when a large of data needs to be stored in the XML file. The program terminates throwing a OutOfMemory error. I earlier used the Document class to read an already generated XML file but this also used to give me the same error so I started using SAXParser. My question is, is there a light-weight XML document builder to avoid such errors being thrown up? Any kind of help is welcome.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A DOM occupies much more space than the data it represents since it creates so many objects.

The simplest XML document builder is to just use print statements to write the tags and contents. If you organize your architecture so that objects represent reasonable chunks of the XML hierarchy, and "know how" to write their contents, it is pretty straightforward.

Bill
 
Ketan KC Chachad
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had read long time before that SAXParser can be used to create XML documents. Is it true? If yes, can you give me the links for reading on it.
 
Where does a nanny get ground to air missles? Protect this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic