[jdom-interest] JDOM JSR

James Strachan james_strachan at yahoo.co.uk
Thu May 17 02:24:44 PDT 2001

From: "Jason Hunter" <jhunter at collab.net>
> > My impression from working with both JDOM and dom4j is that dom4j
> > is at least as far along as JDOM,
> dom4j is a fork of JDOM, started by James Strachan because he wanted an
> interface-based model with factories for object creation, while Brett
> and I (and the majority of people here we believe) didn't want that
> complexity.  It used to be called JDOM+ until we pointed out that
> violated the JDOM license.  James has added some interesting stuff on
> the periphery like event-based building, which I'd like to see added to

dom4j is *not* a patch of JDOM.

If anyone is interested in the history, here it is...

I originally tried to convince the JDOM community that "interfaces are not
bad" and that using factories can help make it easy for developers to extend
Elements and Attributes without having to write their own builders and that
none of these things would adversely affect the JDOM API that much. If you
trawl the archives you'll see many developers ask for interfaces & factories
& help extending Element and Attribute. These ideas kept being discarded as
"too complex" or that "there would be issues" though those detailed issues
were never stated, they were just "in the archives" somewhere.

So to try convince people I made a fork of JDOM called JDOM+ which used
interfaces and factories to allow easy extension and flexible implementation
strategies. This didn't go down to well to say the least and Jason asked me
to take down the site. So I canned JDOM+ in accordance with Jasons wishes.

This pretty much convinced me there was no way forward on these issues in
the JDOM community, it seemed to have been cast in stone that there shall be
no interfaces and the prospect of factories looked bleak.

So dom4j was born.

I started from scratch, with a blank sheet of paper and through discussions
with several like minded people in the JDOM community (off the list), I put
together a bunch of polymorphic interfaces for Node, Branch, Element,
Document, Attribute etc. with support for the Java Collections Framework,
fast navigation and integrated XPath support.

While doing this I used many lessons I'd learned from my experiences with
JDOM. For that I'm truly grateful to Jason, Brett and the rest of the JDOM
community, in particular for showing that a Java API for working with XML
did not need to be as complex as the DOM. As the dom4j API came together it
retained much of the "feel" of JDOM even though the API is quite different.
I also learned a lot from SAX (in particular its event based nature) and DOM
(in particular its use of interfaces and fast navigation) and Java
Collections Framework (in particular its elegant design and use of
interfaces and polymorphism and that for data structures, no one size fits
all (e.g. ArrayList v. LinkedList)).

Once the main interfaces were taking shape I designed a flexible & easy to
use DocumentFactory policy that the "builders" could use making it really
easy to extend Element / Attribute implementations. Its even gone one step
further than that, it allows schema-based extension mechanism, allowing (for
example) specific qualified names of Elements to have their own
DocumentFactory, which is perfect for doing XML Schema and adjunct based
work. (Hopefully this will all be demonstrable really soon). e.g. <foo:bar>
can have its own factory that uses a special implementation of FooBarElement
and its own Attribute implementations.

Finally I did a bunch of implementations of the API, added the "builders",
the readers and writers, integrated event based notification mechansims,
JAXP / XSLT support, implemented the XPath API (with an implementation which
originally started life as Bob's Werken codebase), a few of us worked on it
quite a bit, we did a bunch of testing, it got used in a few companies which
helped kick it into shape and here we are today.

I hope that helps clear up any confusion.


Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

More information about the jdom-interest mailing list