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

tsasala at hifusion.com tsasala at hifusion.com
Wed Jul 26 04:24:52 PDT 2000


> > 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.

	-Tom



More information about the jdom-interest mailing list