[jdom-interest] Replace existing CDATA

Jason Long jason at jmlie.com
Fri Feb 15 22:23:59 PST 2002

I have an Element name as follows:

  <name num="1">
    <![CDATA[Bob Marley & The Wailers - Legend - 02 - No Woman No Cry.mp3]]>

I am using the following code to remove the CDATA and replace it with a
processed version of itself.

  eltName.removeContent((CDATA) eltName.getContent().get(0));
  eltName.addContent(new CDATA(fileName));

Is there a cleaner or better way to accomplish this?

Best Regards,

Jason Long - President
Supernova Software - supernovasoftware.com
BS Physics, MS Chemical Engineering

More information about the jdom-interest mailing list