You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Rahul Shivangi <ra...@gmail.com> on 2013/05/29 11:23:42 UTC

Parsing large xml file requires huge memory

Hi,

currently I am using xerces 2.7 for parsing xml file. Usually my xml file
is of big size about 30-50 MB, parsed DOM tree takes large memory approx.
600-800 MB, which is not feasible for me.

Also I wanted to know is there any way to parse only some part of xml file
using DOM parser. SAX parser is not applicable for me, as I need to
manipulate parsed xml data.

Thanks,
Rahul Shivangi.

Re: Parsing large xml file requires huge memory

Posted by Erik Sjölund <er...@gmail.com>.
You could use a SAX2XMLReader to read out interesting sub trees into
temporary DOMDocument instances.
For instance, check out this public domain source code:
http://scm.codesynthesis.com/?p=xsd/xsd.git;a=blob;f=examples/cxx/tree/streaming/parser.cxx;hb=HEAD
cheers
Erik Sjölund

On Wed, May 29, 2013 at 11:23 AM, Rahul Shivangi <ra...@gmail.com>wrote:

> Hi,
>
> currently I am using xerces 2.7 for parsing xml file. Usually my xml file
> is of big size about 30-50 MB, parsed DOM tree takes large memory approx.
> 600-800 MB, which is not feasible for me.
>
> Also I wanted to know is there any way to parse only some part of xml file
> using DOM parser. SAX parser is not applicable for me, as I need to
> manipulate parsed xml data.
>
> Thanks,
> Rahul Shivangi.
>