[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XOM vs. dom4j


jdom vs dom4j
Robert Koberg wrote:

> I just googled looking for a comparison between XOM and dom4j (what i am 
> currently using) and only found your comparisoin to JDOM. Looking at the 
> XOM information at your site (http://www.cafeconleche.org/XOM/), it 
> looks like XOM and dom4j are similar. Is that the case?

XOM and dom4j were both inspired by JDOM. Neither uses any JDOM code.

dom4j was started by a developer who was dissatisfied with JDOM, and 
wanted to add to it. XOM was started by a developer who was dissatisfied 
with JDOM, and wanted to subtract from it.

One of the many things dom4j adds to JDOM (conceptually, not in code) is 
complete support for DOM interfaces. In other words, a dom4j Element is 
also a DOM2 element. This means dom4j offers all the complexity and 
confusion of DOM, plus its own complexity and confusion on top of that. 
Somehow this doesn't feel to me like progress. To make matters worse, 
dom4j isn't really a conformant implementation of DOM. A lot of the 
methods don't do exactly what the DOM specification says they should.

XOM does not implement DOM. There's only one API to learn and use, and 
its simpler than any tree-based API I've seen in Java. It focuses on 
correctness, simplicity, and performance, *in that order*. JDOM allows 
you to create malformed documents, as do DOM and dom4j. It is simply 
impossible to create a namespace malformed document in XOM (or if it 
isn't, it's a bug; and I will fix it when it's pointed out.)

> I am using less memory after switching from JDOM to dom4j. Would there 
> be a similar benefit going from dom4j to XOM? Do you have any critiques 
> of dom4j in favor of XOM? (I am open to switching.)

I've done a lot of memory profiling on XOM and made serious efforts to 
reduce its memory usage. Right now it seems to need somewhere between 4 
and 5 times the size of the input document to store the model in memory. 
  There are a few more optimizations I plan to explore in the future, 
and I hope to get that down to maybe a factor of 3 (though not in 1.0). 
I don't know what sort of memory profiles JDOM and dom4j have so I can't 
really compare.

XOM does offer a streaming mode in which documents can be processed one 
subtree at a time without storing everything in memory so it can process 
documents much larger than available memory. JDOM has something similar, 
but I think XOM's support for this is better documented and better 
supported.

-- 
Elliotte Rusty Harold  elharo@m...
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.