[jdom-interest] CDATA whitespace

Bradley S. Huffman hip at a.cs.okstate.edu
Tue Jul 9 16:57:24 PDT 2002


What's the creation and use of XMLOutputter look like?

Brad

"Robertson, Jason" writes:

> 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