better root element detection for atom content type xhtml (closes #720)

This commit is contained in:
Andrew Dolgov 2013-06-20 21:16:06 +04:00
parent dda1d43508
commit bc3c887f4f
1 changed files with 14 additions and 2 deletions

View 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);
}
}
}
}