]> git.wh0rd.org - tt-rss.git/commitdiff
better root element detection for atom content type xhtml (closes #720)
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 20 Jun 2013 17:16:06 +0000 (21:16 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 20 Jun 2013 17:16:06 +0000 (21:16 +0400)
classes/feeditem/atom.php

index 9680748f91aa4f03a6e6659dc102c05236c1ec89..fa6b3a34c39ba27f70c74d7cd1288625491370f8 100644 (file)
@@ -58,7 +58,13 @@ class FeedItem_Atom extends FeedItem_Common {
                if ($content) {
                        if ($content->hasAttribute('type')) {
                                if ($content->getAttribute('type') == 'xhtml') {
-                                       return $this->doc->saveXML($content->firstChild->nextSibling);
+                                       for ($i = 0; $i < $content->childNodes->length; $i++) {
+                                               $child = $content->childNodes->item($i);
+
+                                               if ($child->hasChildNodes()) {
+                                                       return $this->doc->saveXML($child);
+                                               }
+                                       }
                                }
                        }
 
@@ -72,7 +78,13 @@ class FeedItem_Atom extends FeedItem_Common {
                if ($content) {
                        if ($content->hasAttribute('type')) {
                                if ($content->getAttribute('type') == 'xhtml') {
-                                       return $this->doc->saveXML($content->firstChild->nextSibling);
+                                       for ($i = 0; $i < $content->childNodes->length; $i++) {
+                                               $child = $content->childNodes->item($i);
+
+                                               if ($child->hasChildNodes()) {
+                                                       return $this->doc->saveXML($child);
+                                               }
+                                       }
                                }
                        }