[jdom-interest] Re: jdom comparison with dom4j

Dennis Sosnoski dms at sosnoski.com
Wed Aug 8 02:11:20 PDT 2001


If you mean cases where the code to do something in JDOM is simpler than the
corresponding code in dom4j, I can't think of any. I think JDOM is simpler in
the sense of providing a more limited set of choices for the user (or a less
confusing variety of possible ways to do something, if you want to look at it
that way).

I'd have to check side by side comparisons of what's supported, but offhand I'd
say that EXML falls pretty close to JDOM in these terms. The dom4j approach of
using multiple layers of interfaces with both abstract and (default) concrete
implementations, factories, etc. gives a lot of flexibility but also can make
for some confusion ("let's see, there's probably a method to do X, but is it an
Element method, a Node method, or...?").

  - Dennis

graham glass wrote:

> hi dennis,
>
> could you give an example of an operation that
> is easier to do using JDOM than using DOM4J?
>
> cheers,
> graham
>
> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Dennis Sosnoski
> Sent: Tuesday, August 07, 2001 7:11 PM
> To: Jane Riese
> Cc: jdom-interest at jdom.org
> Subject: Re: [jdom-interest] Re: jdom comparison with dom4j
>
> 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@yourhos
> t.com
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
> t.com




More information about the jdom-interest mailing list