title: How to return XML in a Zend Framework application
body: <p>I'm having problems returning XML in my ZF application.
  My code:</p>
  
  <pre><code>class ProjectsController extends Gid_Controller_Action
  {
      public function xmlAction ()
      {
          $content = "&lt;?xml version='1.0'&gt;&lt;foo&gt;bar&lt;/foo&gt;";
          header('Content-Type: text/xml');
          echo $content;
      }
  }
  </code></pre>
  
  <p>I've also tried the following:</p>
  
  <pre><code>class ProjectsController extends Gid_Controller_Action
  {
      public function xmlAction ()
      {
          $content = "&lt;?xml version='1.0'&gt;&lt;foo&gt;bar&lt;/foo&gt;";
          $this-&gt;getResponse()-&gt;clearHeaders();
          $this-&gt;getResponse()-&gt;setheader('Content-Type', 'text/xml');
          $this-&gt;getResponse()-&gt;setBody($content);
          $this-&gt;getResponse()-&gt;sendResponse();
      }
  }
  </code></pre>
  
  <p>Could someone point me in the right direction how to achieve this?</p>