[jdom-interest] Important proposal: Element/Document changes

Patrick Dowler Patrick.Dowler at nrc.ca
Wed Jul 26 10:13:29 PDT 2000


On Wed, 26 Jul 2000, Brett McLaughlin wrote:
> >         I think a node interface for elements, entities, attributes, etc.,
> > is a  good idea.  As Jason pointed out though, it wouldn't work for
> > content.  The interface would simplify the API by eliminating all the
> > overloaded methods.
> 
> I just don't see it making sense - there is no common ground between
> these things. Just doing it for tree walking is a waste, and not a
> compelling use case. Look at DOM - half the methods on Node are uesless
> on certain Nodes, but mean something on others - that to me is silly.

The minimal idea is a tag interface (a la Serializable) which in some
respect cleans up the API. However, IMO having overloaded methods
isn't bloating the API because you still only have to know one method...

Overloading is a better approach, and you end up having all those anyway
(maybe as protected methods which are called by the "public addNode(Node n)"
method).

I agree with Brett that a non-trivial common interface or base class
is not too useful as there is little common code and most usage requires
that you know which type of "node" you have anyway.

--

Patrick Dowler
Canadian Astronomy Data Centre




More information about the jdom-interest mailing list