[jdom-interest] Anyone using what's in CVS?

Robin Rosenberg robin.rosenberg.lists at dewire.com
Wed Feb 4 15:14:25 PST 2004


Hi again.

Some more comments; the Child/Parent interfaces are nice from a pure OO
perspective if you were constructing a general tree handling framework.

DOM however is all about XML and not trees in general. The standard parsers
like Xerces etc has the right node classes, but they have the wrong metods on
these classes and the parsers are way too general to be easy to use and customize. 
That's why JDOM caught my attenention. A simple API. Please stick to that. There are 
enough bloated XML libraries as it is.

From a practical point it doesn't help a bit, but complicates a lot.

One of the niceties of JDOM is (was) the Element addContent(X) since it simplifies
using the code. You latest changes transforms a lot of oneliners to three or more
lines.

Of course you may have design goals that I do not know about, so it would be nice
to hear the rationale.

  public Element createXml() {
    return createXmlBase().addContent(_ruleName.toString());
  }

now becomes 

  public Element createXml() {
    Element ret=createXmlBase();
    ret.addContent(_ruleName.toString());
    return ret;
  }

Which is just a waste of space and reduces readability by forcing other code off-screen. (There
may other opinions on this and I'm simply not interested in discussing that aspect further).

The other alternative is to change the return type of createXml with Parent, but then the
code that uses createXml expect an Element so that introduces casting with less type safety
and less efficiency (casting is quite expesive).

-- robin



More information about the jdom-interest mailing list