[jdom-interest] How to ease traversal of JDOM tree

Bradley S. Huffman hip at a.cs.okstate.edu
Mon Nov 19 10:09:48 PST 2001


> add/remove/get/setContent are today only defined by Element and Document
> but should be defined in all classes if we want to be able to traverse
> the tree downward. The add/remove/setContent would then throw an
> exception while getContent could return either an empty List or a List
> containing a single Text object.

Why add these methods to the leaf nodes (Comments, Text, PI, etc.)
where they don't apply? I don't like the idea of throwing a exception
at runtime for something that can be caught at comiple time.

> Opinions?

Why not a Visitor class (see the TODO list)?



More information about the jdom-interest mailing list