Java API DOM/JDOM

Is there a cookbook that explain the main differences about the Dom and the Jdom models and the realization of each with proper methods?
(Like in the book java API migration cookbook that explain how do the same thing via taj or via haj).
I think it would be very useful.
Eventually some links?
Thks @nto

I’ll assume you checked out www.jdom.org and read the docs regarding the main differences between w3c’s DOM API and JDOM’s API… The big win for JDOM is that it’s a more Java friendly API and doesn’t have all the grody “interface vs. implementation” hacks of DOM.

If I were starting fresh (we have a bunch of DOM legacy stuff), I’d pick JDOM just for the API.

The tamino API looks straightforward:

TXMLObjectAccessor connection; // assume this exists…
TQuery q = TQuery.newInstance(“/Document[@ino:id=‘1’]”);
TXMLObjectModel jdom = TJDOMObjectModel.getInstance();
TXMLObjectAccessor accessor = connection.newXMLObjectAccessor(TAccessLocation.newInstance(“Collection”), jdom);

TResponse r = accessor.query(q);

TXMLObjectIterator i = r.getXMLObjectIterator();
TJDOMElementIterator j = new TJDOMElementIterator(i);
while (j.hasNext()) {
org.jdom.Element element = j.next();
// do something interesting here using the JDOM API on ‘element’…
}



This is just from looking at the docs and typed in here with no compilation - the above may not work, but it’s in the ballpark.

For me, I’m interested in what are the technical tradeoffs from one API to another. For instance - it appears that the SAX API isn’t thread safe; is this true for JDOM and DOM as well?