[jdom-interest] insertChild in Element

Simon Harris Haruki_Zaemon at hotmail.com
Wed Aug 30 15:46:05 PDT 2000

FWIW, Implementing List seems like a great idea to me.

----- Original Message -----
From: "Elliotte Rusty Harold" <elharo at metalab.unc.edu>
To: "Jason Hunter" <jhunter at collab.net>; "James W. Howe"
<jwh at allencreek.com>
Cc: "Brett McLaughlin" <brett.mclaughlin at lutris.com>;
<jdom-interest at jdom.org>
Sent: Thursday, August 31, 2000 5:19 AM
Subject: Re: [jdom-interest] insertChild in Element

> At 6:31 PM +0200 8/30/00, Jason Hunter wrote:
> >Then you need the ability to remove a particular child by index too.
> >And the ability to remove all children, remove a child by name, remove
> >all children with a name, add a set of children, remove a set of
> >children, and so on.
> >
> >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?
> It would be fairly easy to make the change. Just use the Proxy design
> pattern where the Element is the proxy for the partial list.
> On a related note, I'm also thinking that PartialList needs to check
> the types of the objects that are added to it. It shouldn't be
> possible to store a Frame or an InputStream or a File or a BigInteger
> or anything except the relevant JDOM types into the content of an
> element. Right now you can.
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |                  The XML Bible (IDG Books, 1999)                   |
> |              http://metalab.unc.edu/xml/books/bible/               |
> |   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
> |  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
> +----------------------------------+---------------------------------+
> _______________________________________________
> To control your jdom-interest membership:

More information about the jdom-interest mailing list