{"action":"closed","issue":{"url":"https://api.github.com/repos/alexdebril/rss-atom-bundle/issues/92","labels_url":"https://api.github.com/repos/alexdebril/rss-atom-bundle/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/alexdebril/rss-atom-bundle/issues/92/comments","events_url":"https://api.github.com/repos/alexdebril/rss-atom-bundle/issues/92/events","html_url":"https://github.com/alexdebril/rss-atom-bundle/issues/92","id":108281072,"number":92,"title":"Extract XML parsing from FeedReader","user":{"login":"romaricdrigon","id":919405,"avatar_url":"https://avatars.githubusercontent.com/u/919405?v=3","gravatar_id":"","url":"https://api.github.com/users/romaricdrigon","html_url":"https://github.com/romaricdrigon","followers_url":"https://api.github.com/users/romaricdrigon/followers","following_url":"https://api.github.com/users/romaricdrigon/following{/other_user}","gists_url":"https://api.github.com/users/romaricdrigon/gists{/gist_id}","starred_url":"https://api.github.com/users/romaricdrigon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/romaricdrigon/subscriptions","organizations_url":"https://api.github.com/users/romaricdrigon/orgs","repos_url":"https://api.github.com/users/romaricdrigon/repos","events_url":"https://api.github.com/users/romaricdrigon/events{/privacy}","received_events_url":"https://api.github.com/users/romaricdrigon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-25T08:04:36Z","updated_at":"2015-09-29T08:01:12Z","closed_at":"2015-09-29T08:01:12Z","body":"Hi,\r\n\r\nAt the moment, XML parsing is done in `FeedReader`:\r\n```php\r\n    public function parseBody(HttpDriverResponse $response, FeedInInterface $feed, array $filters = array())\r\n    {\r\n        if ($response->getHttpCodeIsOk()\r\n            || $response->getHttpCodeIsRedirection()) {\r\n            $xmlBody = new SimpleXMLElement($response->getBody());\r\n            $parser = $this->getAccurateParser($xmlBody);\r\n\r\n            return $parser->parse($xmlBody, $feed, $filters);\r\n        }\r\n...\r\n```\r\n\r\nThe idea would be to introduce a `XMLParser` service, to decouple those 2 aspects. Then users could only override that one, as you would override the HTTP fetcher.\r\nReal life use case is when you want to adapt to malformed XML (typically some WordPress plugins add blank lines before... those are accepted by most RSS aggregators).\r\n\r\nPlease just validate the idea and I will work on the PR :)\r\n"}}