[jdom-interest] Replacing Element Text

Kenworthy, Edward edward.kenworthy at exchange.co.uk
Mon May 14 03:09:02 PDT 2001

I found that a little tricky.

This is what my replace text code currently looks like:

  public void setText(String newText)
    List children = _theElement.getChildren();
    children.add(new CDATA(newText));

Otherwise setting the text will over-write *all* the elements children.

-----Original Message-----
From: Heather Boyd [mailto:hlb at aspectgroup.co.uk]
Sent: 14 May 2001 10:43
To: 'jdom-interest at jdom.org'
Subject: [jdom-interest] Replacing Element Text

I would like to traverse a jdom Document and when I find a String, process
it and, if necessary, 
make a change to it.   I am trying to create a variety of content filters.

I have been reading the archives and have seen that this has been discussed
(modifying text).  

More information about the jdom-interest mailing list