[jdom-interest] java.lang.OutOfMemory with an 10 MB xml file??

Paul Libbrecht paul at activemath.org
Wed Aug 3 13:38:12 PDT 2005

In general XPath over large files is an issue since XPath needs to 
navigate the whole tree.
I think XSLTproc also has troubles but I may mistake.

I see two solutions to your problem:

- use STaX or XPP which are, both, supposed to be the ones with least 
memory impact. I think some support XPath.

- granularize your JDOM parsing: among others, it's easy to parse bits 
and drop them right away if you know they won't match. For example, it 
is easy, I think, to adapt the SAXBuilder so that it fires a sequence 
of nodes, say, of element that you know the name of.

I can only say that the second solution is very "ad hoc" but there 
maybe something general coming out... JDOM chunks, to my taste, are 
things that could be very useful!

Just my 2p.


Le 3 août 05, à 15:58, Sukhvinder Singh a écrit :

> Hi all,
> I am using JDOM XPath, but on trying to load a large xml file (10 MB) 
> to use jdom XPath, I am getting “java.lang.OutOfMemory” error, as my 
> requirement is to use more then 10MB XML files, any idea how 10 MB XML 
> file using a SaxBuilder would run out of memory? How does the DTD 
> validation of an XML parser handle this?
> I'd appreciate any ideas or knowledge in this area.
> Thanks,
> Sukhvinder Singh
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list