Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Another Day, Another Development Release

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Another Day, Another Development Release
  • Date: Sun, 22 Sep 2002 18:38:45 -0400

I've posted XOM 1.0d3 in the usual location at
http://www.cafeconleche.org/XOM/

The major change in this release is the refactoring of the Node classes along the lines suggested by John Cowan and discussed here over the last few days. TreeNode is gone. Its navigation methods have moved into Node. Its insertion and deletion methods are now part of a new ParentNode subclass. Element and Document are now subclasses of ParentNode. Attribute is a subclass of Node.

The other four node types (Comment, Text, ProcessingInstruction, DocType) are now subclasses of LeafNode which is a subclass of Node. I made LeafNode public, not so much because it needs to be as because making it package-private seemed to be confusing people. We had talked about eliminating this class, but it still felt useful to me for code reuse, and there's now a very nice dichotomy between leaf nodes and parent nodes.

Overall, this refactoring resulted in removing 40 pointless methods from the four leaf nodes classes (ten from each class) at the cost of adding six pointless methods to the Attribute class, a net savings of 34 methods. That's pretty good. :-) It is no longer possible to even try to insert or append or remove a child from a leaf node. The methods just aren't there.

On the question of what Attribute.getNextSibling and Attribute. getPreviousSibling should return, I went with null. In the current, ArrayList-based implementation, getNextSibling and getPreviousSibling are probably fairly inefficient navigators. I think most code that's walking the tree should be using indexed access if possible. That said, I'm wishy-washy on this so if a consensus develops to go the other way, I'll flip-flop. :-)

The other, less major change in the API in this release is renaming the add() method to addAttribute() as had been previously discussed here.

I also spent a lot of time in this release cleaning up the JavaDoc. It's much improved, but still needs some work.

The next big project is probably the tutorial. This is very important as the notes from Tuesday are rapidly going out of sync with the current version. :-)
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+



  • [XOM-interest] Another Day, Another Development Release, Elliotte Rusty Harold, 09/22/2002

Archive powered by MHonArc 2.6.24.

Top of Page