[jdom-interest] removing pcdata from jdom-Elements

Kai Wörner kai.woerner at uni-hamburg.de
Fri Mar 11 05:36:08 PST 2005

Hi all,

I want to do this to a XML-Document:

<s>someone said: <q>this sucks bigtime</q> and i agreed</s>


I thought I'll get all Elements via

Iterator myI = doc.getDescendants(new ElementFilter());

iterate through them, look for PCDATA via Element.getText, chop it with a
StringTokenizer, add the Tokens as new <w>-Elements to the actual Element
and get rid of the PCDATA itself. But how do I do this? Is there something
like Element.removeContent(new onlyThePCDATAContentSparingElementsFilter())?



More information about the jdom-interest mailing list