使用Zend的“文档末尾的额外内容”错误

I'm writing a simple CMS using Zend framework. In my IndexController I have function to create an XML document with all the data I need:

public function getpdfdataAction() {

    $this->_helper->layout->disableLayout();

    //////////////////////
    /// Doc init
    //////////////////////

    $docs = new Application_Model_DbTable_Documents();
    $docslist = $docs->fetchAll($docs->select())->toarray();

    /////////////////////
    /// XML init
    ////////////////////

    $xml = new DOMDocument('1.0', 'utf-8');
    $xml->formatOutput = true;

    $root = $xml->createElement('docslist');
    $xml->appendChild($root);


    //////// Docs processing ////////////

    foreach ($docslist as $doc) {

        $testdoc = $xml->createElement('doc');
        $root->appendChild($testdoc);

        if ($doc['isactive']) {

            $testdoc->appendChild($xml->createElement('name',$doc['filename']));
            $testdoc->appendChild($xml->createElement('year',$doc['year']));
            $testdoc->appendChild($xml->createElement('month',$doc['month']));
            $testdoc->appendChild($xml->createElement('issue',$doc['issue']));
            $testdoc->appendChild($xml->createElement('activationdate',$doc['activationdate']));


            $fullUrl = 'http://'.$this->getRequest()->getHttpHost() . '/upload/';
            $testdoc->appendChild($xml->createElement('docdownloadurl',$fullUrl.$doc['filename']));

        } else {
            $testdoc->setAttribute('state','deleted');
            $testdoc->appendChild($xml->createElement('name',$doc['filename']));

        }

    }

    ////////// Output ///////////////////

    $output = $xml->saveXML();

    $this->_response->setHeader('Content-Type', 'text/xml; charset=utf-8')->setBody($output);
} 

Everything seems fine, but when I access this action in browser using /index/getpdfdata I get this error: "Error on line 3 at column 1: Extra content at the end of the document". My data is correctly displayed under "Below is a rendering of the page up to the first error" message.

If I use save() function instead of saveXML() and then open the file it looks fine:

<?xml version="1.0" encoding="utf-8"?>
<docslist>
  <doc>
    <name>5-ipad-lo.pdf</name>
    <year>2011</year>
    <month>10</month>
    <issue>5</issue>
    <activationdate>2011-11-11</activationdate>
    <docdownloadurl>http://mysite:8888/upload/5-ipad-lo.pdf</docdownloadurl>
  </doc>
  <doc>
    <name>event-ru_04.pdf</name>
    <year>2011</year>
    <month>9</month>
    <issue>4</issue>
    <activationdate>2011-01-11</activationdate>
    <docdownloadurl>http://mysite:8888/upload/event-ru_04.pdf</docdownloadurl>
  </doc>
</docslist>

I tried various things, removed foreach cycle, but even this version produces an error:

$xml = new DOMDocument('1.0', 'utf-8');
$xml->formatOutput = true;

$root = $xml->createElement('docslist');
$xml->appendChild($root);
$output = $xml->saveXML();
$this->_response->setHeader('Content-Type', 'text/xml; charset=utf-8')->setBody($output);

Solution? Can Zend add some warnings to the end of the XML document and corrupt it this way? If yes, then how can I monitor these warnings?