[jdom-interest] Text class in the api

Christian Knorr christian.knorr at gmx.de
Wed Oct 24 23:53:03 PDT 2001


> > > One thing is I remember a post about not wanting to force
> > > anyone to use
> > > Text class if they didn't want to, I however think it should be > > > one
> > > way or the other, either Element.content has only Text or
> > > only String for
> > > textual content, but not both.
> >
> > The intent was to keep all the String based methods.  These
> > strings would be
> > kept in the content List of Element inside Text objects.  We
> > would provide
> > methods to directly add Text nodes to an element's content
> > and inside the
> > list, there would not be any Strings.
> 
> I'd say this a little differently - an Element has Text nodes, not > > String
> nodes. But we will keep the convenience methods that can return the
> Element's value as a String, concatenating all the characters from all > its
> Text nodes together. So get*Text*() and setText() stay, but
> addContent(String) and removeContent(String) are replaced by Text > > versions.

This sounds good to me from a user's point of view. If there really is a
need for a text class keeping the String methods getText() and setText()
is essential for JDOM's philosophy of simplicity and ease of use. 

  Christian



More information about the jdom-interest mailing list