protocol7 archive
18 January 2005

XOM 1.0

Elliotte Rusty Harold, a few days ago, released 1.0 of his XML object model, XOM after a fairly well extended beta period. I’ve been using the late beta versions in a few project of mine and must say that I’m very impressed with his work. It simple and straightforward to use (yes, all of you using the empty Transformer to serialize your JAXP Document, I’m talking to you) and produces very consistent results.

As someone that has allways been very annoyed by the lack of interfaces and surplus of implementation classes in the .NET System.Xml library, I find myself a bit surprised by how much I like his design principle of focusing on classes. To create an Element you simply do:
` Element myElm = new Element(“myLocalName”, “”); `

No more passing around a Document just to create all the object you need. But, at the same Elliote doesn’t entirely lock you into his classes, you’re free to subclass them (in a controlled manner, not to let you construct non-wellformed XML documents) and create your own NodeFactory for creating them during parsing.

All in all I can strongly recommend you taking a look at XOM, for some of your applications I think it will significantly simplify your work. And, there’s quite a few samples to get you going.

tags: Java