Skip to content

Commit

Permalink
Using DOMDocument to format the output of Feed::create results in mor…
Browse files Browse the repository at this point in the history
…e readable XML, fixes #3004
  • Loading branch information
Woody Gilk committed Jun 26, 2010
1 parent 34f20b1 commit 71ca9cf
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion classes/kohana/feed.php
Expand Up @@ -145,7 +145,24 @@ public static function create($info, $items, $format = 'rss2', $encoding = 'UTF-
}
}

return $feed->asXML();
if (function_exists('dom_import_simplexml'))
{
// Convert the feed object to a DOM object
$feed = dom_import_simplexml($feed)->ownerDocument;

// DOM generates more readable XML
$feed->formatOutput = TRUE;

// Export the document as XML
$feed = $feed->saveXML();
}
else
{
// Export the document as XML
$feed = $feed->asXML();
}

return $feed;
}

} // End Feed

0 comments on commit 71ca9cf

Please sign in to comment.