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?


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.

| improve this answer | |
  • 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. – Neil Cameron Nov 17 '15 at 16:16
  • Finally managed it using these docs: drupal.org/node/1900312 – Neil Cameron Nov 23 '15 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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