{"action":"created","comment":{"url":"https://api.github.com/repos/fguillot/picoFeed/pulls/comments/30980232","id":30980232,"diff_hunk":"@@ -10,30 +11,131 @@\n  * @author  Frederic Guillot\n  * @package Parser\n  */\n-class Rss10 extends Rss20\n+class Rss10 extends Parser\n {\n     /**\n+     * Register all supported namespaces\n+     *\n+     * The default Namespace:\n+     *   - RSS 1.0 (http://purl.org/rss/1.0/)\n+     *\n+     * Standard RSS 1.0 modules\n+     *   - Dublin Core (http://purl.org/rss/1.0/modules/dc/)\n+     *   - Content (http://purl.org/rss/1.0/modules/content/)\n+     *\n+     * Additionally we do support:\n+     *   - Feedburner (http://rssnamespace.org/feedburner/ext/1.0)\n+     *\n+     * For broken feeds we do support\n+     *   - Atom (http://www.w3.org/2005/Atom)\n+     *\n+     * @access public\n+     * @param  SimpleXMLElement          $xml     Feed xml\n+     * @return SimpleXMLElement\n+     */\n+    public function registerSupportedNamespaces(SimpleXMLElement $xml)\n+    {\n+        $xml->registerXPathNamespace('rss', 'http://purl.org/rss/1.0/');\n+        $xml->registerXPathNamespace('dc', 'http://purl.org/rss/1.0/modules/dc/');\n+        $xml->registerXPathNamespace('content', 'http://purl.org/rss/1.0/modules/content/');\n+        $xml->registerXPathNamespace('feedburner', 'http://rssnamespace.org/feedburner/ext/1.0');\n+        $xml->registerXPathNamespace('atom', 'http://www.w3.org/2005/Atom');\n+\n+        return $xml;\n+    }\n+\n+    /**\n      * Get the path to the items XML tree\n      *\n      * @access public\n      * @param  SimpleXMLElement   $xml   Feed xml\n-     * @return SimpleXMLElement\n+     * @return SimpleXMLElement[]\n      */\n     public function getItemsTree(SimpleXMLElement $xml)\n     {\n-        return $xml->item;\n+        return $xml->xpath('rss:item') ?: $xml->xpath('item');","path":"lib/PicoFeed/Parser/Rss10.php","position":57,"original_position":57,"commit_id":"8c44f4bb332ab11c85f462d4bdf2d162bbdfe4f3","original_commit_id":"abc0476589a37af80ca351200135013da12071bb","user":{"login":"mkresin","id":4547948,"avatar_url":"https://avatars.githubusercontent.com/u/4547948?v=3","gravatar_id":"","url":"https://api.github.com/users/mkresin","html_url":"https://github.com/mkresin","followers_url":"https://api.github.com/users/mkresin/followers","following_url":"https://api.github.com/users/mkresin/following{/other_user}","gists_url":"https://api.github.com/users/mkresin/gists{/gist_id}","starred_url":"https://api.github.com/users/mkresin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkresin/subscriptions","organizations_url":"https://api.github.com/users/mkresin/orgs","repos_url":"https://api.github.com/users/mkresin/repos","events_url":"https://api.github.com/users/mkresin/events{/privacy}","received_events_url":"https://api.github.com/users/mkresin/received_events","type":"User","site_admin":false},"body":"> I thought about adding (if thats the correct url), if there is no default namespace so that rss:item will always work and you dont have to check for non namespaced entries for all elements\r\n\r\nWon't work. You will never get not namespaced elements/nodes if you query for elements within a namespace. Otherwise the it won't be possible to parse the following the XML structure:\r\n\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:mynamespace=\"http://purl.org/rss/1.0/\">\r\n   <mynamespace:channel>\r\n      <mynamespace:title>Feed Title</mynamespace:title>\r\n      <mynamespace:description/>\r\n      <mynamespace:link>http://www.example.test</mynamespace:link>\r\n   </mynamespace:channel>\r\n   <mynamespace:item>\r\n      <mynamespace:title>Item title</mynamespace:title>\r\n      <mynamespace:link>http://www.example.test/item1/</mynamespace:link>\r\n      <mynamespace:description>Item description</mynamespace:description>\r\n   </mynamespace:item>\r\n   <channel>\r\n      <title>Feed Title</title>\r\n      <description/>\r\n      <link>http://www.example.test</link>\r\n   </channel>\r\n   <item>\r\n      <title>Item title</title>\r\n      <link>http://www.example.test/item1/</link>\r\n      <description>Item description</description>\r\n   </item>\r\n</rdf:RDF>\r\n```","created_at":"2015-05-25T13:40:59Z","updated_at":"2015-05-25T13:40:59Z","html_url":"https://github.com/fguillot/picoFeed/pull/157#discussion_r30980232","pull_request_url":"https://api.github.com/repos/fguillot/picoFeed/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/fguillot/picoFeed/pulls/comments/30980232"},"html":{"href":"https://github.com/fguillot/picoFeed/pull/157#discussion_r30980232"},"pull_request":{"href":"https://api.github.com/repos/fguillot/picoFeed/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/fguillot/picoFeed/pulls/157","id":36093636,"html_url":"https://github.com/fguillot/picoFeed/pull/157","diff_url":"https://github.com/fguillot/picoFeed/pull/157.diff","patch_url":"https://github.com/fguillot/picoFeed/pull/157.patch","issue_url":"https://api.github.com/repos/fguillot/picoFeed/issues/157","number":157,"state":"open","locked":false,"title":"[RFC] add propper support of namespaces, use xPath for XML Parsing","user":{"login":"mkresin","id":4547948,"avatar_url":"https://avatars.githubusercontent.com/u/4547948?v=3","gravatar_id":"","url":"https://api.github.com/users/mkresin","html_url":"https://github.com/mkresin","followers_url":"https://api.github.com/users/mkresin/followers","following_url":"https://api.github.com/users/mkresin/following{/other_user}","gists_url":"https://api.github.com/users/mkresin/gists{/gist_id}","starred_url":"https://api.github.com/users/mkresin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkresin/subscriptions","organizations_url":"https://api.github.com/users/mkresin/orgs","repos_url":"https://api.github.com/users/mkresin/repos","events_url":"https://api.github.com/users/mkresin/events{/privacy}","received_events_url":"https://api.github.com/users/mkresin/received_events","type":"User","site_admin":false},"body":"Picofeed has only basic XML namespace support. This could result into situations where at least default namespaced - valid - atom or RSS 1.0 feeds couldn't be parsed. An example of such a feed is http://www.tandfonline.com/action/showFeed?ui=0&mi=h7u81o&ai=1g8&jc=rcel20&type=etoc&feed=rss.\r\n\r\nCurrently I'm rewriting the parser to support such feeds as well. I'm finished with the RSS 1.0 parser, but I'm interested in feedback before touching the other parser.\r\n\r\nIs there anything I didn't took care of @Raydiation @fguillot? Any new bugs introduced? Did I reverted something that was added because of compatibility reasons or similar?\r\n\r\n# Using xPath queries\r\nThe returned values of xPath queries are  more predictable. It's either an empty array or an array of not empty SimpleXMLElements. In case of a malformed xPath query, it's FALSE (which should be independent of user supplied content).\r\n\r\nThe SimpleXMLElement access object property notation returns in opposite:\r\n  * empty object for elements which doesn't exist.\r\n  * NULL if the the parent node of a requested element doesn't exist\r\n\r\nFurthermore the namespace handling is way more easier and robust. If the feed uses namespaces without declaring them, the namespace prefix gets removed from nodes/elements and they are accessible like they never where namespaced.\r\n\r\n## Possible incompatibilities\r\n\r\nIf a feed uses a wrong namespace uri, it's very likely that the namespaced nodes/elements aren't found any longer by picofeed. At the moment, default namespaces are ignored completely, so the namespace uri could be any string without the risk of trouble.\r\n\r\n# Code simplification\r\nthe isset()'s aren't required since:\r\n  * current returns FALSE if the array is empty and (string) of FALSE is an empty string\r\n  * (string) of an empty SimpleXMLElement is an empty string\r\n  * (string) of NULL is an empty string\r\n\r\n# RSS 1.0 specific changes:\r\n\r\n## Fixes\r\n* feed logo: the image element is a child of the root node and not of the channel node\r\n\r\n## Improvements\r\n* feed title: use the \"title\" element of the Dublin Core module as last effort\r\n* feed description: use the \"description\" element of the Dublin Core module as last effort\r\n* item title: use the \"title\" element of the Dublin Core module as last effort\r\n* item description: use the \"description\" element of the Dublin Core module as last effort\r\n* item language: use the \"language\" element of the Dublin Core module as indicator for the item language instead of nothing\r\n\r\n## Changes\r\n* item id: use the Dublin Core \"identifier\" element as id (the Dublin Core module defines \"identifier\" as an \"unambiguous reference to the resource)\r\n* item date: none of the standard RSS 1.0 modules define a \"pubDate\" nor a \"updated\" item child element\r\n* item author: none of the standard RSS 1.0 modules define a \"author\" nor a \"webMaster\" item child element\r\n\r\nSorry for creating a second PR. I've accidentally deleted the wrong branch, the PR got closed automatically and it's not possible to reopen the PR again.","created_at":"2015-05-23T21:01:05Z","updated_at":"2015-05-25T13:40:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e144cc40b29cd36192d2a374e510fa0a9970284","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fguillot/picoFeed/pulls/157/commits","review_comments_url":"https://api.github.com/repos/fguillot/picoFeed/pulls/157/comments","review_comment_url":"https://api.github.com/repos/fguillot/picoFeed/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fguillot/picoFeed/issues/157/comments","statuses_url":"https://api.github.com/repos/fguillot/picoFeed/statuses/8c44f4bb332ab11c85f462d4bdf2d162bbdfe4f3","head":{"label":"mkresin:master","ref":"master","sha":"8c44f4bb332ab11c85f462d4bdf2d162bbdfe4f3","user":{"login":"mkresin","id":4547948,"avatar_url":"https://avatars.githubusercontent.com/u/4547948?v=3","gravatar_id":"","url":"https://api.github.com/users/mkresin","html_url":"https://github.com/mkresin","followers_url":"https://api.github.com/users/mkresin/followers","following_url":"https://api.github.com/users/mkresin/following{/other_user}","gists_url":"https://api.github.com/users/mkresin/gists{/gist_id}","starred_url":"https://api.github.com/users/mkresin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkresin/subscriptions","organizations_url":"https://api.github.com/users/mkresin/orgs","repos_url":"https://api.github.com/users/mkresin/repos","events_url":"https://api.github.com/users/mkresin/events{/privacy}","received_events_url":"https://api.github.com/users/mkresin/received_events","type":"User","site_admin":false},"repo":{"id":28295124,"name":"picoFeed","full_name":"mkresin/picoFeed","owner":{"login":"mkresin","id":4547948,"avatar_url":"https://avatars.githubusercontent.com/u/4547948?v=3","gravatar_id":"","url":"https://api.github.com/users/mkresin","html_url":"https://github.com/mkresin","followers_url":"https://api.github.com/users/mkresin/followers","following_url":"https://api.github.com/users/mkresin/following{/other_user}","gists_url":"https://api.github.com/users/mkresin/gists{/gist_id}","starred_url":"https://api.github.com/users/mkresin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkresin/subscriptions","organizations_url":"https://api.github.com/users/mkresin/orgs","repos_url":"https://api.github.com/users/mkresin/repos","events_url":"https://api.github.com/users/mkresin/events{/privacy}","received_events_url":"https://api.github.com/users/mkresin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mkresin/picoFeed","description":"Modern PHP library to parse RSS/Atom feeds","fork":true,"url":"https://api.github.com/repos/mkresin/picoFeed","forks_url":"https://api.github.com/repos/mkresin/picoFeed/forks","keys_url":"https://api.github.com/repos/mkresin/picoFeed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mkresin/picoFeed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mkresin/picoFeed/teams","hooks_url":"https://api.github.com/repos/mkresin/picoFeed/hooks","issue_events_url":"https://api.github.com/repos/mkresin/picoFeed/issues/events{/number}","events_url":"https://api.github.com/repos/mkresin/picoFeed/events","assignees_url":"https://api.github.com/repos/mkresin/picoFeed/assignees{/user}","branches_url":"https://api.github.com/repos/mkresin/picoFeed/branches{/branch}","tags_url":"https://api.github.com/repos/mkresin/picoFeed/tags","blobs_url":"https://api.github.com/repos/mkresin/picoFeed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mkresin/picoFeed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mkresin/picoFeed/git/refs{/sha}","trees_url":"https://api.github.com/repos/mkresin/picoFeed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mkresin/picoFeed/statuses/{sha}","languages_url":"https://api.github.com/repos/mkresin/picoFeed/languages","stargazers_url":"https://api.github.com/repos/mkresin/picoFeed/stargazers","contributors_url":"https://api.github.com/repos/mkresin/picoFeed/contributors","subscribers_url":"https://api.github.com/repos/mkresin/picoFeed/subscribers","subscription_url":"https://api.github.com/repos/mkresin/picoFeed/subscription","commits_url":"https://api.github.com/repos/mkresin/picoFeed/commits{/sha}","git_commits_url":"https://api.github.com/repos/mkresin/picoFeed/git/commits{/sha}","comments_url":"https://api.github.com/repos/mkresin/picoFeed/comments{/number}","issue_comment_url":"https://api.github.com/repos/mkresin/picoFeed/issues/comments{/number}","contents_url":"https://api.github.com/repos/mkresin/picoFeed/contents/{+path}","compare_url":"https://api.github.com/repos/mkresin/picoFeed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mkresin/picoFeed/merges","archive_url":"https://api.github.com/repos/mkresin/picoFeed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mkresin/picoFeed/downloads","issues_url":"https://api.github.com/repos/mkresin/picoFeed/issues{/number}","pulls_url":"https://api.github.com/repos/mkresin/picoFeed/pulls{/number}","milestones_url":"https://api.github.com/repos/mkresin/picoFeed/milestones{/number}","notifications_url":"https://api.github.com/repos/mkresin/picoFeed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mkresin/picoFeed/labels{/name}","releases_url":"https://api.github.com/repos/mkresin/picoFeed/releases{/id}","created_at":"2014-12-21T10:00:31Z","updated_at":"2015-04-28T09:34:14Z","pushed_at":"2015-05-25T11:49:37Z","git_url":"git://github.com/mkresin/picoFeed.git","ssh_url":"git@github.com:mkresin/picoFeed.git","clone_url":"https://github.com/mkresin/picoFeed.git","svn_url":"https://github.com/mkresin/picoFeed","homepage":"http://fguillot.github.io/picoFeed","size":2621,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fguillot:master","ref":"master","sha":"fcbcabb69ca950a315dfbd2034f9f269b21fbc26","user":{"login":"fguillot","id":323546,"avatar_url":"https://avatars.githubusercontent.com/u/323546?v=3","gravatar_id":"","url":"https://api.github.com/users/fguillot","html_url":"https://github.com/fguillot","followers_url":"https://api.github.com/users/fguillot/followers","following_url":"https://api.github.com/users/fguillot/following{/other_user}","gists_url":"https://api.github.com/users/fguillot/gists{/gist_id}","starred_url":"https://api.github.com/users/fguillot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fguillot/subscriptions","organizations_url":"https://api.github.com/users/fguillot/orgs","repos_url":"https://api.github.com/users/fguillot/repos","events_url":"https://api.github.com/users/fguillot/events{/privacy}","received_events_url":"https://api.github.com/users/fguillot/received_events","type":"User","site_admin":false},"repo":{"id":8106011,"name":"picoFeed","full_name":"fguillot/picoFeed","owner":{"login":"fguillot","id":323546,"avatar_url":"https://avatars.githubusercontent.com/u/323546?v=3","gravatar_id":"","url":"https://api.github.com/users/fguillot","html_url":"https://github.com/fguillot","followers_url":"https://api.github.com/users/fguillot/followers","following_url":"https://api.github.com/users/fguillot/following{/other_user}","gists_url":"https://api.github.com/users/fguillot/gists{/gist_id}","starred_url":"https://api.github.com/users/fguillot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fguillot/subscriptions","organizations_url":"https://api.github.com/users/fguillot/orgs","repos_url":"https://api.github.com/users/fguillot/repos","events_url":"https://api.github.com/users/fguillot/events{/privacy}","received_events_url":"https://api.github.com/users/fguillot/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fguillot/picoFeed","description":"Modern PHP library to parse RSS/Atom feeds","fork":false,"url":"https://api.github.com/repos/fguillot/picoFeed","forks_url":"https://api.github.com/repos/fguillot/picoFeed/forks","keys_url":"https://api.github.com/repos/fguillot/picoFeed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fguillot/picoFeed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fguillot/picoFeed/teams","hooks_url":"https://api.github.com/repos/fguillot/picoFeed/hooks","issue_events_url":"https://api.github.com/repos/fguillot/picoFeed/issues/events{/number}","events_url":"https://api.github.com/repos/fguillot/picoFeed/events","assignees_url":"https://api.github.com/repos/fguillot/picoFeed/assignees{/user}","branches_url":"https://api.github.com/repos/fguillot/picoFeed/branches{/branch}","tags_url":"https://api.github.com/repos/fguillot/picoFeed/tags","blobs_url":"https://api.github.com/repos/fguillot/picoFeed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fguillot/picoFeed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fguillot/picoFeed/git/refs{/sha}","trees_url":"https://api.github.com/repos/fguillot/picoFeed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fguillot/picoFeed/statuses/{sha}","languages_url":"https://api.github.com/repos/fguillot/picoFeed/languages","stargazers_url":"https://api.github.com/repos/fguillot/picoFeed/stargazers","contributors_url":"https://api.github.com/repos/fguillot/picoFeed/contributors","subscribers_url":"https://api.github.com/repos/fguillot/picoFeed/subscribers","subscription_url":"https://api.github.com/repos/fguillot/picoFeed/subscription","commits_url":"https://api.github.com/repos/fguillot/picoFeed/commits{/sha}","git_commits_url":"https://api.github.com/repos/fguillot/picoFeed/git/commits{/sha}","comments_url":"https://api.github.com/repos/fguillot/picoFeed/comments{/number}","issue_comment_url":"https://api.github.com/repos/fguillot/picoFeed/issues/comments{/number}","contents_url":"https://api.github.com/repos/fguillot/picoFeed/contents/{+path}","compare_url":"https://api.github.com/repos/fguillot/picoFeed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fguillot/picoFeed/merges","archive_url":"https://api.github.com/repos/fguillot/picoFeed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fguillot/picoFeed/downloads","issues_url":"https://api.github.com/repos/fguillot/picoFeed/issues{/number}","pulls_url":"https://api.github.com/repos/fguillot/picoFeed/pulls{/number}","milestones_url":"https://api.github.com/repos/fguillot/picoFeed/milestones{/number}","notifications_url":"https://api.github.com/repos/fguillot/picoFeed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fguillot/picoFeed/labels{/name}","releases_url":"https://api.github.com/repos/fguillot/picoFeed/releases{/id}","created_at":"2013-02-09T04:16:49Z","updated_at":"2015-05-22T06:45:01Z","pushed_at":"2015-05-25T11:49:37Z","git_url":"git://github.com/fguillot/picoFeed.git","ssh_url":"git@github.com:fguillot/picoFeed.git","clone_url":"https://github.com/fguillot/picoFeed.git","svn_url":"https://github.com/fguillot/picoFeed","homepage":"","size":3873,"stargazers_count":165,"watchers_count":165,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":32,"mirror_url":null,"open_issues_count":11,"forks":32,"open_issues":11,"watchers":165,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fguillot/picoFeed/pulls/157"},"html":{"href":"https://github.com/fguillot/picoFeed/pull/157"},"issue":{"href":"https://api.github.com/repos/fguillot/picoFeed/issues/157"},"comments":{"href":"https://api.github.com/repos/fguillot/picoFeed/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/fguillot/picoFeed/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/fguillot/picoFeed/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fguillot/picoFeed/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/fguillot/picoFeed/statuses/8c44f4bb332ab11c85f462d4bdf2d162bbdfe4f3"}}}}