[jdom-interest] insertChild in Element
donaldp at mad.scientist.com
donaldp at mad.scientist.com
Wed Aug 30 19:17:43 PDT 2000
I think I would like this approach - it makes a lot more
sense semantically thou it would still take getting used
to. You can always have getChildren() return this to
implement current functionality. I guess this turns JDOM
into more of a *Object* model structure rather than *XML*
object model but it could be worth it - if you could
implement it as/more efficiently than ArrayList
On Wed, 30 Aug 2000 trebor.a.rude at lmco.com wrote:
> If the JDOM is the first XML API a programmer learns, then you're probably
> right. However, for those coming from DOM, the second model is what they're
> used to. Personally, I didn't find adapting to the List model that
> difficult, but I hadn't used the DOM for very long when I switched to JDOM.
> As usual, both sides have their merits. One advantage to having Element
> implement List is that it doesn't break existing code, if you're more
> comfortable with the first model, you can still use it.
>
> Trebor A. Rude
> trebor.a.rude at lmco.com
>
> > -----Original Message-----
> > From: Tom Jenkins [SMTP:tjenkins at devis.com]
> > Sent: Wednesday, August 30, 2000 1:13 PM
> > To: jdom-interest at jdom.org
> > Subject: RE: [jdom-interest] insertChild in Element
> >
> > Hello all,
> >
> > > -----Original Message-----
> > <snip>
> > > >All these things are easily done with the List returned by
> > getChildren()
> > > >using standard Java APIs. I think it's better to give people access to
> > > >the List for them to manipulate as they like than reproduce all the
> > List
> > > >functionality in Element.
> > > >
> > >
> > > Lately I'm not so sure of that. Certainly, the getting the children
> > > and then operating on the list doesn't seem to be obvious. What if
> > > Element and Document implemented List instead of containing a List?
> > > Would this be more obvious? Would it be more closely reflect people's
> > > mental models of XML elements?
> > <snip>
> >
> > 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.
> >
> >
> >
> > Tom Jenkins
> > Systems Analyst
> > Development Infostructure
> > http://www.devis.com
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourh
> > ost.com
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
>
--
Cheers,
Pete
*--------------------------------------------------*
| Latrobe University, | Does the name 'Pavlov' |
| Bundoora, Australia | ring a bell ? |
*--------------------------------------------------*
More information about the jdom-interest
mailing list