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.
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.
Ketan KC Chachad
posted 14 years ago
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.