[jdom-interest] Lightweight JDOM? (again)

philip.nelson at omniresources.com philip.nelson at omniresources.com
Mon Feb 18 17:43:03 PST 2002

> I've searched the archives, and I can't find answers to my 
> specific questions about JDOM's lightweightness.
> I've read that "injects more XML semantics into the tree than 
> does DOM.  To DOM, everything is Node.  To JDOM, you have 
> Attribute, Element, and Namespace nodes." How does that make 
> JDOM more lightweight than DOM?

It doesn't make it more lightweight.  That fact that DOM classes implement a
Node interface and JDOM doesn't doesn't mean much for being lightweight.  It
means that you don't have to use factories to create a new instance of a
class like you do with DOM.

> I've read that, with JDOM "an XML document can be seen as a 
> whole, and any member of that document is available at any 
> time." Does this mean that, with DOM, any member of a 
> document isn't available at any time? If so, can you clarify? 
> To reach a deeply nested node in a DOM tree, you have to 
> start at the top, and go through various descendent nodes. Do 
> you not have to do with with JDOM?

Yes.  The syntax is much simpler though.  

> I think I've read that DOM requires you to have the entire 
> document in memory all at once, but JDOM can have pieces of 
> the document in memory at once (and yet maintain a global 
> view of the document). If this is the case, how does JDOM 
> achieve this where DOM does not?

That would be a good JDOM trick.  Actually, the hope is that a deferred
builder can load partial documents but I think this will be put off until
after the 1.0 release.  From the looks of it, the "lightweight" aspect is
going to be most realized in the next beta.  Getting the api to work
correctly has been the first order of business here.

More information about the jdom-interest mailing list