Sponsored Link •
Elliotte Rusty Harold talks with Bill Venners about the design lessons he learned from the JDOM API.
Elliotte Rusty Harold is a prolific author of numerous books about Java and XML, and creator of the popular Java website Cafe au Lait and XML website Cafe con Leche. He contributed to the development of JDOM, a popular XML processing API for Java. His most recent book, Processing XML with Java, shows how to parse, manipulate, and generate XML from Java applications using several XML APIs, including SAX, DOM, and JDOM.
At a meeting of the New York XML SIG in September, 2002, Harold unveiled an XML processing API of his own design: the XOM (XML Object Model) API. On Cafe au Lait and Cafe con Leche, Harold described XOM like this:
Like DOM, JDOM, dom4j, and ElectricXML, XOM is a read/write API that represents XML documents as trees of nodes. Where XOM diverges from these models is that it strives for absolute correctness and maximum simplicity. XOM is based on more than two years' experience with JDOM development, as well as the last year's effort writing Processing XML with Java. While documenting the various APIs I found lots of things to like and not like about all the APIs, and XOM is my effort to synthesize the best features of the existing APIs while eliminating the worst.
In this interview, which is being published in multiple installments, Elliotte Rusty Harold discusses the strengths and weaknesses of the various XML processing APIs for Java, the design problems with existing APIs, and the design philosophy behind XOM.
Bill Venners: What did you learn from JDOM?
Elliotte Rusty Harold: I learned a hell of a lot from JDOM. Number one, I learned it is possible to fight the W3C and win. Just today I heard from one of the attendees at this conference that they couldn't really use XML until JDOM came along, because XML and the corresponding APIs were too complex. Once they got JDOM, then they could use XML. A lot of people are using JDOM.
Bill Venners: What do you mean by, "fight the W3C and win?"
Elliotte Rusty Harold: The W3C had published their semi-official tree-based API for XML: DOM. Nonetheless, JDOM is still very useful. Many people are using it, liking it, and enjoying it. Just because the W3C has staked out territory in this space doesn't mean that if you come along with something better for some people, that you can't be successful too.
Bill Venners: What else did you learn from JDOM?
Elliotte Rusty Harold: I learned a lot of things technically. For example, I learned that it is not necessary to write your own XML parser, which is a relatively hard proposition. Instead you could use any SAX parser to build your own object model in memory. Similarly I learned you didn't need to write your own XPath engine or XSLT processor to have XPath and XSLT support. For XPath you could use Jaxen. For XSLT you could use Trax. I learned you could build on top of these other existing technologies.