When returning XML from an API endpoint in Symfony2 using FosRestBundle I am trying to change the root XML element to something more flexible (this may not always be an Entity so want to do this without the JMSSerializerBundle.
Currently returning:
<response> <capacity>10</capacity> <availability>10</availability> </response> I would like it to return:
<mycustomrootelement> <capacity>10</capacity> <availability>10</availability> </mycustomrootelement> I am not sure if I can register a custom service to do this, maybe extend the default XMLEncoder or similar and then configure this in the FOS configuration.
At the moment I am just returning the response and can not see anyway to customize this.
Has anyone achieved this - some advice would be GRAND!!
No comments:
Post a Comment