Error printing xml nodes using \n
<p>I want to print each element of an xml document on a new line without using <code>&lt;br/&gt;</code>.</p>

<p>Here is the code I'm using but it skips the "\n". Please help</p>

<pre><code>&lt;?php
$xmlstr= '&lt;Address&gt;&lt;to&gt;James&lt;/to&gt;&lt;from&gt;Jani&lt;/from&gt;&lt;heading&gt;Reminder&lt;/heading&gt;&lt;body&gt;Please check your mail.&lt;/body&gt;&lt;/Address&gt;' ;     
$xml = simplexml_load_string($xmlstr);
echo $xml-&gt;getName() . "\n";

foreach($xml-&gt;children() as $child)
  {
  echo $child-&gt;getName() . ": " . $child . "\n";
  }
?&gt;
</code></pre>

<p>The required output:</p>

<pre>
Address
to: James
from: Jani
heading: Reminder
body: Please check your mail.
</pre>
