I'm finishing a magazine article today on XOM, a new XML object model for Java by Elliotte Rusty Harold. The class library is impressive -- I haven't found a more easy to use, intuitive way to read, write, and manipulate XML documents with Java.

Harold describes his design principles for XOM in a provocative essay that's worth reading by any programmer designing an API regardless of language. It's filled with quotable advice like this:

"One of the jobs of the expert or experts who designs the API is to know better than the client programmers what they should be doing. It is the API's task to lead the client programmers in the right direction by making the right path easy and the wrong path difficult to impossible."

Using XOM, I wrote an RSS filter application in only 38 lines. The program searches RSS feeds for specified text in titles, producing a new feed that contains only the matching items and shorter indentation (for example, filtering an RSS feed for Java articles). Also, the feed's title is changed and an RSS 0.91 document type declaration is added if the feed is version 0.91 and the declaration is missing.

Add a Comment

All comments are moderated before publication. These HTML tags are permitted: <p>, <b>, <i>, <a>, and <blockquote>. This site is protected by reCAPTCHA (for which the Google Privacy Policy and Terms of Service apply).