[jdom-interest] insertChild in Element

trebor.a.rude at lmco.com trebor.a.rude at lmco.com
Thu Aug 31 08:17:42 PDT 2000


So which would you prefer?  If I had to choose, I'd say go with the current
implementation and in fact maybe even get rid of the existing
addContent/removeContent functions that are currently in Element (except
maybe for the ones that deal with the text content), so that all
manipulation of the children is through the List. The user can choose
between getChildren() and getMixedContent() depending on if they want just
the Element children or all of them.

Trebor A. Rude
trebor.a.rude at lmco.com

> -----Original Message-----
> From:	David W. Smiley [SMTP:dsmiley at mitre.org]
> Sent:	Thursday, August 31, 2000 8:02 AM
> To:	jdom-interest at jdom.org
> Subject:	RE: [jdom-interest] insertChild in Element
> 
> I totally agree with what Tom Jenkins said:
> 
> > I don't think Element should implement List.  To my mental model,
> > Element ->
> > List is not an "is-a" relation, but rather a "has-a".
> > 
> > The line:
> >         element.getChildren().add(newElement, 3);
> > makes perfect sense. But the alternative line:
> >         element.add(newElement, 3);
> > just doesn't feel right.
> 
> 	Also, I don't think JDOM should have both getChildren and be the
> list
> itself.  This means there are two ways to do the same thing which I
> think should be avoided in an API.  It's not like we have to support
> backwards-compatible JDOM clients as JDOM isn't yet v1.0.
> 
> -- David Smiley
> 



More information about the jdom-interest mailing list