[jdom-interest] Using JDOM and LARGE XML Files ...

Jools Enticknap jools at jools.org
Thu Jan 11 13:09:36 PST 2001


Hi Jon
 
> I am in the middle of working some that requires building an XML object
> stack and parsing and I would like to use JDOM if it makes sense.  The
> XML files are pretty large (about 400k at most) and I was originally
> going to try and create a dumb SAX handler instead but Id like to use
> JDOM instead because Id like to query it.

Use JDOM. You'll get more sleep, or you'll get to stay up later hacking
on JDOM (Jason, you know what I mean!)

I'm using JDOM to parse files upto 1MB in size, and JDOM is more than
capable of handling that amount of data.

Plus, JDOM is only ever going to get lighter and faster and more 
efficient as time goes on, and you'll get that for free. If you go
down the SAX route, it'll be upto you to ensure that it always works.
 
> The question though is that I am not going to need to query alot of the
> subelements of the second rootelement and was wondering if I could tweak
> the SAXBuilder somewhere to not report or fill up the Document during
> the build (hope that made sense).
> 
> Question is where can this be accomplished the right way is it inside
> the SAXHandler class itself?

Well, you can't extend SAXHandler because it's package protected, and
I'm not sure that making it public is a Good Thing (TM).

Either delete the unrequired data after the Document is parsed, or
just live with the extra memory usage.
 
--Jools



More information about the jdom-interest mailing list