[jdom-interest] setText() to replace children?

Kai Runte krunte at ebi.ac.uk
Tue Jul 10 02:08:48 PDT 2001


Hello,

the idea sounds good. It would some thing much easier, but what happens if
one has the following piece of XML:

<outer-element>
  A fine sentence without a verb.
  <inner-element/>
  Dang! Another sentence...
</out-element>

What happens after calling:
myElement.setText("This sentence has a verb.");

Either this like in the original version (not desired):
<outer-element>
  This sentence has a verb.
</outer-element>

or:
a)
<outer-element>
  This sentence has a verb.
  <inner-element/>
</outer-element>

b)
<outer-element>
  <inner-element/>
  This sentence has a verb.
</outer-element>

Can JDOM decide which version is expected? Or should we have another
parameter, which flags something like "InsertBeforeChildren"
"InsertAfterChildren"?

What do you think?
	Kai

On Mon, 9 Jul 2001, Brett McLaughlin wrote:
> One item in the TODO file:
> 
> * Consider if setText() should not replace children
> 
> I think setText() should set the text of the element, removing any other
> text in the element. However, I don't think any other children (such as PIs,
> comments, etc) should be affected. Does anyone agree/disagree? I'd like to
> get rid of this one in a few days.
> 
> -Brett
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> 

-- 
Real cats don't need names.
But they often get called them.
"Yaargeroffoutofityarbastard" does nicely.
	Terry Pratchett - The Unadulterated Cat

*********************************************************************
* email: krunte at ebi.ac.uk                                           *
* (PGP signed & encrypted mail preferred)                           *
* Look for PGP-key(s) at:                                           *
* http://www-math.uni-paderborn.de/pgp/                             *
*********************************************************************




More information about the jdom-interest mailing list