[jdom-interest] Re: jdom comparison with dom4j

Dennis Sosnoski dms at sosnoski.com
Tue Aug 7 17:11:17 PDT 2001

Hi Jane,

I've worked with both, and used both in performance comparisons currently published
at http://www.sosnoski.com/opensrc/xmlbench/index.html. I'm currently trying to get
an updated series of tests completed and published, and should have that available
soon. Here's my take on the two:

JDOM strives for simplicity and protection of the user from doing things which don't
fit XML, while dom4j puts the emphasis on flexibility. dom4j is more the traditional
library approach, exposing as many options as possible to allow customization for a
particular use, while JDOM wants to make basic XML operations easy.

If you don't know much about XML and just want to do fairly conventional things with
it (build a document to be serialized out as text, read a document and manipulate it
in memory, etc.) JDOM is probably the better choice. If you have a good knowledge of
XML and may want to do something "tricky" (parse a streamed document with on-the-fly
processing, use custom Element/Attribute structures, share the in-memory document
with DOM-based code, etc.), dom4j is probably the better choice.

JDOM has the advantage that it's in a JSR to possibly become a Java standard
extension. dom4j has the advantage of being more stable and mature for use in
production environments (the JDOM interface is still changing, while dom4j appears
stable except for added methods to expose new functionality). In terms of
performance, there are no big differences between either of these (or between these
and DOM models, for that matter), though dom4j looks better by most measures.

I'm very interested in hearing reactions to this summary, and I've donned my
flame-suit. ;-)

  - Dennis

Jane Riese wrote:

> Hi -
>     I have been using jdom for the past year and
> am pleased with the reduction in code and ease
> of use.  My boss has asked me to look at dom4j
> as an alternative.
>    Can anyone give me a first-hand comparison of jdom and
> dom4j? What are the advantages and intended usage
> of  each of these libraries?
>   Thanks,
> Jane Riese
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list