title: How to generate xml in codeigniter
body: <p>I am trying to generate xml from database query.</p>
  
  <p>Here is generated xml link: <strong><a href="http://mydeal.ge/api/xml" rel="noreferrer">http://mydeal.ge/api/xml</a></strong></p>
  
  <p>But when I try to parse this xml, I get an error: <a href="http://wallsparade.com/test.php" rel="noreferrer">http://wallsparade.com/test.php</a>.</p>
  
  <p>My code is: </p>
  
  <pre><code>public function xml()
      {
          $res = $this-&gt;db-&gt;query('custom query');
          if($res-&gt;num_rows() &gt; 0)
          {$output =  '&lt;?xml version="1.0"?&gt;'. "\n";
              $output .= "&lt;deals&gt;";
              foreach($res-&gt;result() as $item)
          {
              $output .= "&lt;sale id = '".$item-&gt;id."'&gt;";
              $output .= "&lt;link&gt;".$item-&gt;link."&lt;/link&gt;";
              $output .= "&lt;title&gt;".urlencode($item-&gt;title)."&lt;/title&gt;";
              $output .= "&lt;image&gt;".$item-&gt;image."&lt;/image&gt;";
              $output .= "&lt;text&gt;".urlencode($item-&gt;text)."&lt;/text&gt;";
              $output .= "&lt;time&gt;".$item-&gt;time."&lt;/time&gt;";
              $output .= "&lt;price&gt;".$item-&gt;price."&lt;/price&gt;";
              $output .= "&lt;parcent&gt;".$item-&gt;parcent."&lt;/parcent&gt;";
              $output .= "&lt;/sale&gt;";
          }
          $output .= '&lt;/deals&gt;';
          }
  
          echo $output;
  
      }
  </code></pre>
  
  <p>What is problem?</p>