[jdom-interest] setText() to replace children?
Bart Read
bart at wdi.co.uk
Wed Jul 11 03:59:13 PDT 2001
Er.... I think perhaps that's what I just said?
=================================
Bart Read
Senior Developer
Abbotsbury Software Ltd
Abbotsbury, DORSET DT3 4JT
Tel: +44 (0) 1305 871644
E-mail: bart at wdi.co.uk
=================================
----- Original Message -----
From: "Ian Lea" <ian.lea at blackwell.co.uk>
To: <jdom-interest at jdom.org>
Sent: Wednesday, July 11, 2001 10:52 AM
Subject: Re: [jdom-interest] setText() to replace children?
> Bart Read wrote:
> >
> > I have to broadly agree with Alex Rosen on this one. getText() should
just
> > get the text, possibly throwing a RuntimeException if there is mixed
> > content. If you want all of the content you should use getContent(). I
> > think the function that setText() should perform is more open to debate.
My
> > personal opinion is that it should replace all child content of the
element
> > in question. If you want to set mixed content then there are more
> > appropriate methods: setContent(List content) and the various forms of
> > addContent(). If you're dealing with mixed content I really can't see
why
> > you'd want to use getText() in the first place. Conversely if you have
an
> > element that only contains text do you really want to get back a List
and
> > then have to cast the first object to a String in order to get at it?
>
> Absolutely not. I use getText() and setText() a lot on elements
> that I know only contain text and they do exactly what I want. Would
> have no objection to an exception being thrown if the element didn't
> just contain text.
>
>
> --
> Ian.
> ian.lea at blackwell.co.uk
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
>
> ---------- Automatically inserted by mailhost.wdi.co.uk ------------
> This message has been scanned for virus, trojans, illegal relays and
> spam. If you have any comments, problems or questions please do not
> hesitate to contact:
> Abbotsbury Software Ltd
> Tel: +44 1305 871543 Fax: +44 1305 871688
> Email: postmaster at wdi.co.uk
> Web: http://www.wdi.co.uk/virus.phtml
More information about the jdom-interest
mailing list