It seems whenever Drupal 8 generates an XML output it gets wrapped in <response> tags. I'm defining a custom rest resource (e.g. like this) and can see no way of modifying this containing tag. The service which is consuming the XML feed breaks when it encounters this tag. Is there anyway I can remove it?

1 Answer 1


Rest plugins always use the standard seralization methods, you can't really influence that for just your plugin. You could implement your own, like ?_format=my_fancy_xml.

Or, if you have very specific needs an an existing client that you need to work with, you can always just implement a normal controller and build the XML yourself and return it with a normal Response object.

  • Thanks very much for your response, perhaps a custom REST format is the way to go. Will take a look at how much work that is. Nov 17, 2015 at 16:16
  • Finally managed it using these docs: drupal.org/node/1900312 Nov 23, 2015 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.