[ajug-members] To JDOM or to not JDOM...that is the question..

Paul Bemowski bemowski at yahoo.com
Fri Nov 14 16:24:48 EST 2008


I would recommend strongly against JDom on the basis of this statement:
"So I have this very, very large XML file..."

JDom will load the entire xml file into RAM.  Bad move - even if it works today, if that XML file is expected to grow - it may not work tomorrow.  I'm in the middle of writing a lightweight SAX based system to replace a JDOM based parser that started blowing up JVMs as the data files grew with the application.

Given that I've told you not to use JDOM, what should you use?  
 - XSL - XSL is a black art.  It is have programming language, half markup language.  Iteration, conditionals, etc can be difficult to implement using XSL.  I have written XSL when it makes sense, but I don't like it.
 - SAX - if you ahve very very large files (100s of mb), then consider a SAX based event stream conversion scenario.  This is custom code - and lightweight.  And you never have to read either the input file or output file into memory at any given point.  Stream in, stream out.  Very performant, will work up to the limits of your disk rather than the limits of your memory.

That's my .02.

Paul




________________________________
From: Gary Marshall <gwjm56 at gmail.com>
To: ajug-members at ajug.org
Sent: Friday, November 14, 2008 1:43:38 PM
Subject: [ajug-members] To JDOM or to not JDOM...that is the question..

All

I have what I think is a typical data extraction task.  Given an input XML file, build another XML file containing smaller, more meaningful data elements.  I was told to use JDOM to complete this task and so far in my research I cannot find a way to do this using JDOM.  However, heres a disclaimer:  I'm a newbie at JDOM.

So I have this very, very large XML file that contains lots and lots of what I'll call "parent" elements.  Each parent element has lots of child elements.  I need to capture the parent element and certain child elements (not all of the child elements) and build the output XML file.  Simple, right?  I need to navigate the entire XML file and for each parent element get certain child elements that belong to that parent.

To JDOM or not to JDOM?  Can anybody point me in the direction where I can get an idea as to how to accomplish this task?

Thanks much for your time.
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ajug.org/pipermail/ajug-members/attachments/20081114/d4fd45e6/attachment-0001.html 


More information about the ajug-members mailing list