RSS Feed for This PostCurrent Article

XOM: New XML Object Model

XOM is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with Java that strives for correctness, simplicity, and performance, in that order.

As quoted, XOM is designed to be easy to learn and easy to use. It works very straight-forwardly, and has a very shallow learning curve. Assuming you’re already familiar with XML, you should be able to get up and running with XOM very quickly.

XOM is the only XML API that makes no compromises on correctness. XOM only accepts namespace well-formed XML documents, and only allows you to create namespace well-formed XML documents. (In fact, it’s a little stricter than that: it actually guarantees that all documents are round-trippable and have well-defined XML infosets.) XOM manages your XML so you don’t have to. With XOM, you can focus on the unique value of your application, and trust XOM to get the XML right.

Some sample code here for parsing a document

public class XMLPrinter {
    public static void main(String[] args) {
        if (args.length <= 0) {
          System.out.println("Usage: java nu.xom.samples.XMLPrinter URL");
        try {
          Builder parser = new Builder();
          Document doc =[0]);
        catch (ParsingException ex) {
          System.out.println(args[0] + " is not well-formed.");
        catch (IOException ex) { 
           "Due to an IOException, the parser could not print " 
           + args[0]

Popularity: 1% [?]

Trackback URL

RSS Feed for This PostPost a Comment