XOM Design Principles


XOM Design Principles

Elliotte Rusty Harold

Javapolis 2005

Wednesday, December 13, 2005

elharo@metalab.unc.edu

http://www.cafeconleche.org/


A few opinions

XML was, as has been fretted over before, ugly, hard, and boring to code with. Not any more :). XOM rocks! I'm using it in all my projects now.

Keep it up!

--Patrick Collison


I did some XML Programming during the last month with Java's DOM. this was not funny !! I also played with Ruby's powerful REXML. this is a great API becaue it uses the power of Ruby and it was designed for Ruby and is not a generic interface like DOM. this is way REXML is so popular in the Ruby world.

and this is why I like XOM. for me it fits much better to Java than DOM. I hope that XOM will become for Java what REXML is for Ruby now.

--Markus Jais


Overall, I found XOM to be an amazingly well-organized, intuitive API that's easy to learn and to use. I like how it reinforces good practices and provides insight about XML -- such as the lack of whitespace when XML is produced without a serializer and the identical treatment of text whether it consists of character entities, CDATA sections, or regular characters.

I can't compare it to JDOM, but it's appreciably more pleasant to work with than the Simple API for XML Processing.

--Rogers Cadenhead


XOM has the best API ever.

In my app we churn business objects into XHTML then XSL:FO and finally PDF. XOM makes it super easy to build the XHTML tree. And if I play my cards right, I might be able to turn that XHTML into FO without serializing it to bytes first. Amazing.

XOM makes XML fun again! Get rid of SAX, DOM and hardcoded "<html>". Get XOM, be happy.

--Jesse Wilson


XOM is the most correct and easiest to use XML tree and streaming API I've come across so far.

--Wolfgang Hoschek on the xom-interest mailing list, Wednesday, 5 Jan 2005 12:11:06

XOM is the most correct and easiest to use XML tree and streaming API I've come across so far.

--Wolfgang Hoschek on the xom-interest mailing list, Wednesday, 5 Jan 2005 12:11:06


i spent yesterday writing the code to render my application config as xml. using xom was like falling off a log. no muss, no fuss, the methods did what i expected, and any confusion was quickly ironed out by a visit to the (copious) examples, or the javadocs. i did run into what might be a bug, but it only showed up because i made a dumb cut-n-paste error (see my other email).

after i get the output tidied up, i'll move on to reading it back in. i'm confident that that will be almost as easy...

--Dirk Bergstrom


Why Me?


Four Styles of XML API


Push APIs


Pull APIs


Data Binding APIs


Tree APIs


DOM


DOM Ugliness


Reasons for DOM Ugliness


What I learned from DOM


JDOM


Is JDOM too Java-centric?


What I learned from JDOM


dom4j


Conclusion: We can do better


nu.xom: A New XML Object Model


Design Goals


XML Principles


Design Principles


Principles of API Design


Java Principles


Development Style


Performance


How does XOM differ from JDOM?


In XOM's Favor


XOM is simpler!

Number of public methods (and constructors) in DOM2 JDOM XOM 1.1
Node 25 8 * 13
Attribute 5 29 20
Element 16 73 37
ProcessingInstruction 3 14 9
Comment 0 5 9
Builder N/A 32 ** 16
Document 17 41 13
Total 66 202 117

* Content

** SAXBuilder


Future Directions


Props


To Learn More


Index | Cafe con Leche

Copyright 2004 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified July 30, 2004