I want to return in my RandomController::indexAction() an XML Response:
return new Response($this->renderView(
'AcmeRandomBundle:Random:index.xml.twig',
array(
'randomParameter' => $randomParameter
)
));
where index.xml.twig is like that:
<?xml version="1.0" encoding="UTF-8"?>
<randomTag>
{{ randomParameter }}
</randomTag>
When I want to open this action in firefox, I get in firebug:
<html>
<body>
<randomTag>
randomValue
</randomTag>
</body>
</html>
How to return correct XML response?
$randomParameter?randomParameterremained untranslated by Twig. It should work even the response was not XML but HTML.