0

I got into trouble rendering XML from controller.

I have tried https://stackoverflow.com/a/4442879/647723

If I do -

$this->getResponse()->setBody($xmlContent);

I get "Headers already sent", even if I used

$response->clearHeader() method.

If I do -

header("Content-type: text/xml");
//$this->loadLayout(false);
echo $xmlContent;
//$this->renderLayout();
exit();

I get the desired output but the note the desired formatting. Chrome, Firefox show them as bunch of text. To generate xml for $xmlContent, I used SimpleXml tool. Can you help so that I can render dynamic XML properly on screen?

Thanks.

Community
  • 1
  • 1
Raman
  • 97
  • 1
  • 11

1 Answers1

0

Finally found it. There was a space before the php tag in the controller class. And that drove me nuts. For others in similar issues, make sure your controller is compact.

Raman
  • 97
  • 1
  • 11