The DOM parser will store everything in a DOM tree in memory, so even if you
split the tile into multiple parts it won't make any difference on the
memory usage in the end. Unless you split the XML file into smaller
independant files that you can parse one at a time.

If you must parse the large file as is you should use a SAX parser and act
on the contents as it gets parsed so that you can discard any unneeded data.

 / Per

2008/2/27, harshabi <[EMAIL PROTECTED]>:
>
>
> Hello all,
> I have very large xml file to parse say about 1GB. I thought of breaking
> the
> file into smaller files of 4K size and parsing it. Is it possible?? I have
> the code. but the Memory consumption is very high. It takes up all the
> memory and runs out of memory.
> If i use the release() method to release the memory held up by any object
> i
> get error that i am accesing an object that does not exist. Is there no
> way
> around the problem???
> a sample snippet of the code is as follows...
>
> do
> {
> /*make a file called source which is 4k in size*/
> parser_(source);
> /*parser_ is a object of XercesDOMParser class*/
>
> /*parse the file */
> /*delete the file*/
> parser_.reset();
> /*I have used parser_.reset() to release the memory held by it but still
> the
> usage of memory increases*/
> }while(dwBytesRead==BUFSIZE);
> /*some condition*/
> --
> View this message in context:
> http://www.nabble.com/Parsing-large-xml-files-tp15707534p15707534.html
> Sent from the Xerces - C - Users mailing list archive at Nabble.com.
>

Reply via email to