{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/8959","repository_url":"https://api.github.com/repos/cakephp/cakephp","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/8959/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/8959/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/8959/events","html_url":"https://github.com/cakephp/cakephp/issues/8959","id":159324954,"number":8959,"title":"XML views from the doc doesn't work.","user":{"login":"alysson-azevedo","id":2701975,"avatar_url":"https://avatars.githubusercontent.com/u/2701975?v=3","gravatar_id":"","url":"https://api.github.com/users/alysson-azevedo","html_url":"https://github.com/alysson-azevedo","followers_url":"https://api.github.com/users/alysson-azevedo/followers","following_url":"https://api.github.com/users/alysson-azevedo/following{/other_user}","gists_url":"https://api.github.com/users/alysson-azevedo/gists{/gist_id}","starred_url":"https://api.github.com/users/alysson-azevedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alysson-azevedo/subscriptions","organizations_url":"https://api.github.com/users/alysson-azevedo/orgs","repos_url":"https://api.github.com/users/alysson-azevedo/repos","events_url":"https://api.github.com/users/alysson-azevedo/events{/privacy}","received_events_url":"https://api.github.com/users/alysson-azevedo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-09T04:14:11Z","updated_at":"2016-06-09T04:33:05Z","closed_at":"2016-06-09T04:33:05Z","body":"This is a (multiple allowed):\r\n* [x] bug\r\n* [ ] enhancement\r\n* [ ] feature-discussion (RFC)\r\n\r\n* CakePHP Version: CakePHP 3.\r\n\r\n### What you did\r\nFollowing the [docs](http://book.cakephp.org/3.0/en/views/json-and-xml-views.html#json-and-xml-views) i'm able to use the Serialize Key to output as JSON. But if I try the same thing with Xml it fails.\r\n\r\nI configured the routes to allow xml extension, loaded the RequestHandler component, then in the `UsersController`:\r\n\r\n    $users = $this->Users->find()->all();\r\n    $this->set(compact('users'));\r\n    $this->set('_serialize', true);\r\n\r\n### Expected Behavior\r\n\r\nWhen i call `/users.json`, i get:\r\n```\r\n{\r\n    \"users\": [\r\n        {\r\n            \"id\": 1,\r\n            \"fields\": \"omitted for brevity\"\r\n        },\r\n        {\r\n            \"id\": 2,\r\n            \"fields\": \"omitted for brevity\"\r\n        },\r\n        {\r\n            \"id\": 3,\r\n            \"fields\": \"omitted for brevity\"\r\n        }\r\n    ]\r\n}\r\n```\r\nAnd i expected that calling `/users.xml` i'd get the same content, but as xml.\r\n\r\n### Actual Behavior\r\n\r\nBut when i call `users.xml` i get:\r\n```\r\n<response>\r\n    <message>Invalid input.</message>\r\n    <url>/users/</url>\r\n    <code>500</code>\r\n</response>\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/224797722","html_url":"https://github.com/cakephp/cakephp/issues/8959#issuecomment-224797722","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/8959","id":224797722,"user":{"login":"alysson-azevedo","id":2701975,"avatar_url":"https://avatars.githubusercontent.com/u/2701975?v=3","gravatar_id":"","url":"https://api.github.com/users/alysson-azevedo","html_url":"https://github.com/alysson-azevedo","followers_url":"https://api.github.com/users/alysson-azevedo/followers","following_url":"https://api.github.com/users/alysson-azevedo/following{/other_user}","gists_url":"https://api.github.com/users/alysson-azevedo/gists{/gist_id}","starred_url":"https://api.github.com/users/alysson-azevedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alysson-azevedo/subscriptions","organizations_url":"https://api.github.com/users/alysson-azevedo/orgs","repos_url":"https://api.github.com/users/alysson-azevedo/repos","events_url":"https://api.github.com/users/alysson-azevedo/events{/privacy}","received_events_url":"https://api.github.com/users/alysson-azevedo/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T04:33:05Z","updated_at":"2016-06-09T04:33:05Z","body":"Nevermind, i just reread everthing and find the answer:\r\n\r\n> Defining _serialize as an array has the added benefit of automatically appending a top-level <response> element when using XmlView. If you use a string value for _serialize and XmlView, make sure that your view variable has a single top-level element. Without a single top-level element the Xml will fail to generate."}}
{"actor":{"display_login":"alysson-azevedo"}}