The Future of JDOM for processing XML using Java

by Kevin Bedell

I frequently point to O'Reilly's Java and XML a great technical book. It's well written and helps you pick the technology up quickly.

JDOM was initially written by Jason Hunter and Brett McLaughlin during development of Java and XML. Here's Jason's account of how JDOM came to be. Jason is still the main force behind JDOM.

I use JDOM whenever I need to process XML with Java. It's just easier and faster than any of the alternatives. DOM is too clumsy and SAX isn't intuitive enough to be easy for most uses.

JDOM is such a great way to process XML in Java, that it was put on track by Sun (through the JCP process and JSR-102) to actually become a part of the Java specification. On the approval ballot for making JDOM a part of the Java specification, SUN's comment was:

"In general we tend to prefer to avoid adding new APIs to the Java platform which replicate the functionality of existing APIs.

However JDOM does appear to be significantly easier to use than the earlier APIs, so we believe it will be a useful addition to the platform."

But even though JDOM has been widely adopted by Java developers, its progress toward finalizing the JCP process has stalled. In fact, it's not even release 1.0 software yet (which flies in the face of other advice I've given on adopting open source technologies).

So what's up with JDOM and where is it heading? That subject was discussed in a recent extended thread on the jdom-interest list. According to Jason:

"The short summary appropos to your concerns is that after I went self employed a little over a year ago, my free time dried up. I offered JDOM stewardship to a few individuals, but they declined. Laurent and Brad are still energetic and great coders and have fixed any bugs as they've appeared, but the project's been going without a strong rudder. I realize we need to get to a 1.0 and have been trying to arrange my schedule to help lead that."

So Jason's been carrying the load on JDOM for a long time and - like many of us (including me!) - doesn't have time to be the chief developer and JSR lead for JDOM forever!

This to me shows one of the great business benefits of open source. If a commercial company had developed JDOM and was on the verge of going out of business - your company could be in big trouble if you were using it. The support might dry up, new releases would end, and any bugs you found would go unfixed.

But since JDOM is open source, even if Jason decided to chuck it tomorrow (which he won't), you'd still have all the source code plus existing commiters, an active user base and a discussion list (with archives on-line). The worst that could happen is that JDOM wouldn't improve much - but it's already solid and production proven anyway.

So where is JDOM heading? Jason has got a plan and some energy left. The plan is to hunker down and focus on a release 1.0 (though the software is already much more solid than any pre-1.0 release of commercial software I've ever used).

And what about moving the JSR specification forward? According to Jason:

"As far as the JCP goes, I think it's more important with limited resources to get a 1.0 software release out. To push JDOM through the JCP process would require a volunteer to lead it."

Any volunteers?


2003-04-01 11:32:41
dom4j is much better than JDOM
The API is better designed and the implementation is actually stable.
2003-04-01 12:13:51
dom4j is much better than JDOM
Thanks for the comment - JDOM has always done what I needed and has been easy to use and teach to others. But I haven't deployed anything using DOM4J - I'll look into it more.

For those who are unfamiliar with one or the other of JDOM and DOM4J, here is a link to an article that compares them side by side:

2003-04-02 07:08:05
dom4j is much better than JDOM
"actually stable"? "better designed"?

thats just your opinion. its not even valid criticism because you dont bring up any real points. many users have found it to be stable already in production. also, the API is easy to use - thats just a fact. thats why its so popular!! I sincerely hope a 1.O version comes out(with xsl + xpath!!) and that the JSR continues. imagine combining it with JXpath from apache! give an xpath, get a node tree/node content back!

2003-04-02 08:04:48
dom4j is much better than JDOM
Of course it's just my opinion! However, in the interests of sparking discussion, I'll bring up some real points:

stability - jdom is in perpetual beta. dom4j is up to release 1.3.

api - jdom has some weird anathema towards interfaces, which makes you do lots of instanceof if/else blocks when dealing with arbitrary tree structures. dom4j has a well-designed interface hierarchy.

those two issues aside, the two apis are pretty much on par. lightweight tree object model - check. integrated xpath support - check. integrated xslt support - check. given that, i choose to go with the project that's not stuck in perpetual beta and has a better api. but to each his own!

2003-04-02 10:30:29
dom4j is much better than JDOM
If the question is stability then i say it is more than stable! I have used JDOM on five commercial products and several personal projects (10+). I have NEVER seen any issues with stability. Who cares if its called "beta" as that doesnt appear to mean a damn thing in this case. Mucho kudos to Jason and his team!!

PS im not anonymous: paul(at)

2003-04-02 10:42:51
dom4j is much better than JDOM
At the risk of faning the flames here, I have to agree that I've never, ever had any problem with stability.

We use JDOM with web services apps that communicate using XML and have literally had many thousands of transactions using pretty complex XML without any problem. (Now, if only *my* code could get that stable...).

2003-04-02 14:57:54
Have you heard of XOM?
When it comes to XML object models, I have tried them all. You can read a good comparison of DOM vs. JDOM on my website. Personally, I like XOM. It was designed from the ground up learning from the mistakes of DOM, JDOM, dom4j, and other attempts at a Java API for XML. The mailing list is very active and the XML/Java expert Elliotte Rusty Harold, who started the project, is fully committed to it so progess is excellent. Currently, it doesn't have full XSLT and XPath support, but when it does it will be my first choice for processing XML.


2003-04-02 18:48:56
Have you heard of XOM?
I agree with you! I found an article (with examples) on the JavaPro magazine. Went online to check it out, used it myself and cannot imagine any other easier more intuitive API to process XML...

- Vlad

2003-04-05 03:50:57
JDom and memory consumption
I'm using JDom since last year and I think the API is really good, but it eats too much ram. For an example, a 300Kb simple XML file (simple means not a very structured tree) gives me an OutOfMemoryError, so I had to increase the heap up to 128Mb! But in real-life applications it usually happens to deal with XML files a lot bigger than 300Kb...
2003-04-06 23:32:15
dom4j is much better than JDOM
I have also much better experience with dom4j. Before trying dom4j I worked with JDOM which had so many bugs, that I had to replace it with something else. All this was more than a year ago. Maybe JDOM improved since than.

Dominik Roblek

2003-04-09 00:56:46
Project perenity thanks to the open source approach, really ???
I just find funny your comment on the perenity of the project thanks to the open source approach. Aren't you actually demonstrating just the opposite? As I read your article, it appears to me that Jason can't find anyone to replace him at the head of the project. I know that a lot of software companies are going bankrupt nowadays, but doesn't they remain a (more) fair bet than the devotion of an individual? If Jason has a family, he will give up sooner or later and, as this stands now, the project will die, open source or not. You won't make me believe that developers working in companies will continue with JDOM as far as they have the source code at hand. Simply, they will develop their next project with the next open source (or not) equivalent of JDOM and slowly move their existing code base. It would be stupid not to do so, would it?


2003-04-09 09:35:06
Project perenity thanks to the open source approach, really ???
Bertrand -

An Open Source project lives as long as it adds value - and there is broad agreement that JDOM adds a great deal of value right now. In fact, if there is an issue with people contributing patches, new code, etc to JDOM then it's most likely due to the fact that most users, like me, find it already gives them everything they need.

It's been said that open source innovation begins with a programmer 'scratching a personal itch' - or solving a problem a better way than the methods already at hand. With JDOM, there aren't that many of these itches to scratch - it already does what we need (personally speaking here).

But if Jason leaves, someone will pick up where he left off if JDOM provides the best solution for their problem. Good open source projects don't just disappear - if they add value then people will use them.

And, yes, I am saying that "developers working in companies will continue with JDOM". That's who built it (and many, many other packages) - who do you think develops the open source software that you use? Certainly very few people have the luxury of getting paid for it.

But in the end, if it stops adding value and something newer and better comes along, then I too will stop using it. JDOM was an innovation and another innovation is certain to eclipse it in time.

My bet, though, is that we'll see people using this technology for years into the future - because it solves a problem well, is reliable and there's a community of users that will support each other no matter who leads it.

Just my thoughts - and thanks for the dialog.


PS. What does 'perenity' mean anyway? It's not in this dictionary or this one either....

2003-04-09 12:46:49
Project perenity thanks to the open source approach, really ???
> Just my thoughts - and thanks for the dialog.

You are welcome, really. However, you should really avoid this type of post-scriptum that does not bring anything useful or constructive to your posts. Don't forget, there is a full bunch of non-native speakers on the Net, and O'Reilly and you wouldn't sell that much books without them.

2003-04-21 03:00:11
JDom and memory consumption
Ok, it seems that the new jdom-b9-rc1 solves the memory bug and it's a lot faster.
2003-05-02 09:36:55
dom4j is much better than JDOM
A table by the same author comparing the various XML models at dom4j's web site (so it may be a little biased, I don't know) but it does seem dom4j is superior

2003-05-29 08:35:55
JDom and memory consumption
What JDK/JRE are you using?