From: Andrew Dolgov Date: Thu, 20 Jun 2013 17:16:06 +0000 (+0400) Subject: better root element detection for atom content type xhtml (closes #720) X-Git-Tag: 1.9~99 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bc3c887f4f1c0fd1b9a0a2bd290980683988106e;p=tt-rss.git better root element detection for atom content type xhtml (closes #720) --- diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index 9680748f..fa6b3a34 100644 --- a/classes/feeditem/atom.php +++ b/classes/feeditem/atom.php @@ -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); + } + } } }