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

Brett McLaughlin brett.mclaughlin at lutris.com
Wed Jul 26 10:03:44 PDT 2000


tsasala at hifusion.com wrote:
> 
> > > Must addContent(xxxx) and removeContent(xxxx) both be overloaded by all
> > > Node types?  Lets just say, for the sake of argument, that there is a
> > > Node interface that simply flagged Element, Entity, etc. as being a
> > > Node. (Maybe it should be called Content, anyways...).  Then, if you
> > > wanted to enable the ability to add/remove an element at a certain
> > > index, you would have addContent(idx,Node) and removeContent(idx,Node).
> > > All the instanceof's would only be around twice, once for each of
> > > these.  addContent(Node) and removeContent(Node) would immediately call
> > > their add/Remove(idx,Node) counterparts with a... lets say a
> > > Integer.MAX_VALUE which signifies that it goes on the end.  Would this
> > > be easier overall?  There would be fewer methods, and it wouldn't really
> > > be a big deal doing the if-else instanceof section twice.
> >
> > Can't do it even if we wanted to.  Strings can't extend Node.
> >
> 
>         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.

-Brett

> 
>         -Tom
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 
http://www.lutris.com
http://www.enhydra.org




More information about the jdom-interest mailing list