Getting Error "Below is a rendering of the page up to the first error."
<p>I am using XMLWriter to create xml.Below is my code which is working fine.</p>

<pre><code>&lt;?php
header("Content-Type: text/xml;");
$writer = new XMLWriter(); 
$writer-&gt;openMemory();  
$writer-&gt;startDocument('1.0'); 
$writer-&gt;setIndent(4); 
$writer-&gt;startElement('epp'); 
$writer-&gt;startElement("command"); 
$writer-&gt;startElement("login"); 
$writer-&gt;writeElement('clID', 'hello'); //username
$writer-&gt;writeElement('pw', 'abcdefg'); //password
$writer-&gt;endElement(); //login
$writer-&gt;endElement(); //command
$writer-&gt;endElement(); //login
$writer-&gt;endDocument(); 
$file =  $writer-&gt;outputMemory(true); 
echo $file;

?&gt;
</code></pre>

<p>If am using below code I am getting error "Getting Error "Below is a rendering of the page up to the first error.". </p>

<pre><code>&lt;?php
$time  = time();
echo $time;
header("Content-Type: text/xml;");
$writer = new XMLWriter(); 
$writer-&gt;openMemory();  
$writer-&gt;startDocument('1.0'); 
$writer-&gt;setIndent(4); 
$writer-&gt;startElement('epp'); 
$writer-&gt;startElement("command"); 
$writer-&gt;startElement("login"); 
$writer-&gt;writeElement('clID', 'hello'); //username
$writer-&gt;writeElement('pw', 'abcdefg'); //password
$writer-&gt;endElement(); //login
$writer-&gt;endElement(); //command
$writer-&gt;endElement(); //login
$writer-&gt;endDocument(); 
$file =  $writer-&gt;outputMemory(true); 
echo $file;

?&gt;
</code></pre>

<p>Error:For above block of code below is the error:I am getting this in google chrome:</p>

<pre><code> This page contains the following errors:

 error on line 1 at column 1: Document is empty
 Below is a rendering of the page up to the first error.
</code></pre>

<p><strong>If I am not using header("Content-Type: text/xml;"); then above block of code is working but time is displaying and not giving the xml format.</strong> Below is the error:</p>

<pre><code>1354510317 hello abcdefg
</code></pre>

<p><strong>EDIT:</strong> 
In Mozilla I am getting below erro:</p>

<pre><code>XML Parsing Error: not well-formed
Location: http://localhost/example.php
Line Number 1, Column 11:1354512268&lt;?xml version="1.0"?&gt;
 ----------^
</code></pre>

<p>If I have done anything wrong with my code please suggest.</p>

<p>How "Below is a rendering of the page up to the first error." error can
 be removed?</p>
