Question

I've used jdom in the past, and have looked briefly at XOM and DOM4j. Each seems to provide essentially the same thing, as they each provide a simplified wrapper over the (very obtuse) standard W3C DOM APIs.

I know that JDOM went through some effort to develop a JSR and standardization process at one point, but as far as I know that effort never went anywhere. All of the project appear to be in stasis with little new development in the past several years.

Is there a consensus as to which is the best? Also what are the pros and cons of each ?

Was it helpful?

Solution

I like XOM, because I like the way Elliotte Rusty Harold thinks. Of the ones you mention I belive it's the one that strays away from the DOM standard API:s the most, but I consider that a benefit.

I once implemented a DOM library for Cocoa, and XOM was my inspiration.

I've worked with JDOM as well, and there's absolutely nothing wrong with it, although I do prefer XOM.

OTHER TIPS

While dom4j is an old player, we have been using it for a while and haven't regret it yet. Strong features: simplicity, xpath support and others. Weak sides: yet to support java 5.0, but version 2.0 has been finally announced.

It all depends on the feature set. If you want to benefit from an XSL Transformation Engine (Like Xalan) or an XPath Engine (Like Jaxen or Saxon) I would recommend sticking to the more popular framework available like Apache Xerces, JDOM.

After that, it's all a matter of taste. I personnally use a W3C compliant ( org.w3c.* ) like Apache Xerces because they are common enough, reasonably fast and well supported by the Java Community.

Of course, if you need blinding speed and do not care about XPath, XQuery or XSL, you can surely find yourself something that is much faster and/or resource-hungry. (i.e. A StAX Implementation)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top