title: WriteCData XMLWriter and new line in PHP
body: <p>I'm trying to add new line in a CData node with XMLWriter in PHP.</p>
  
  <pre><code>$xml = new XMLWriter(); 
  $xml-&gt;openURI('php://output'); 
  $xml-&gt;startDocument('1.0', 'UTF-8'); 
  $xml-&gt;setIndent(true);
  
  $str = "my string\nmy string";
  $xml-&gt;startElement('test');
  $xml-&gt;writeCData($str);
  $xml-&gt;endElement();
  $xml-&gt;endDocument();
  </code></pre>
  
  <p>But the output doesn't return any new line as I wrote "\n"...</p>
  
  <p>returns :</p>
  
  <pre><code>&lt;test&gt;my string    my string&lt;/test&gt;
  </code></pre>
  
  <p>instead of :</p>
  
  <pre><code>&lt;test&gt;my string
  my string
  &lt;/test&gt;
  </code></pre>
  
  <p>I saw on other posts that some users use the "&amp; #10;" code or "&amp; #xD;" (without space) but when I put it in my $str variable, thoses characters are escaped and XMLWriter writes it as output, and doesn't make a new line.</p>
  
  <p>Do you have some ideas ?</p>
  
  <p>Thank you very much !</p>