[jdom-interest] CDATA whitespace

Robertson, Jason Jason.Robertson at acs-inc.com
Tue Jul 9 15:48:49 PDT 2002


I have this is document #1:

  <something><![CDATA[
     Some Multiline
     Text.
  ]]></something>

And when I get the CDATA part and clone it into document #2 like this:

  Element something = parent.getChild("something");
  CDATA cdata = (CDATA) something.getContent().get(0);
  doc2Root.addContent(new Element("elem").addContent((CDATA)
cdata.clone()));

I get this in document #2 (when output with XMLOutputter):

  <elem><![CDATA[Some Multiline Text.]]></elem>

Is this correct behavior with regards to the dropping of the whitespace?  

Jason



More information about the jdom-interest mailing list