title: How to preserve newlines in CDATA when generating XML?
body: <p>I want to write some text that contains whitespace characters such as <code>newline</code> and <code>tab</code> into an xml file so I use</p>
  
  <pre><code>Element element = xmldoc.createElement("TestElement");
  element.appendChild(xmldoc.createCDATASection(somestring));
  </code></pre>
  
  <p>but when I read this back in using</p>
  
  <pre><code>Node vs =  xmldoc.getElementsByTagName("TestElement").item(0);
  String x = vs.getFirstChild().getNodeValue();
  </code></pre>
  
  <p>I get a string that has no newlines anymore.<br>
  When i look directly into the xml on disk, the newlines seem preserved. so the problem occurs when reading in the xml file.</p>
  
  <p>How can I preserve the newlines?</p>
  
  <p>Thanks!</p>