Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

space before XML invalidates feedburner feed


Reply

2 Posts   1212 Views

Avatar
Bruce B

14 May 2009 at 7:03pm Community Member, 145 Posts

I'm trying to use Feedburner with a blog but it keeps rejecting the feed because the XML declaration starts on the second line.

How do I remove that first line from the feed?

I've tried adding

$body = ltrim($body);


to outputToBrowser in RSSFeed.php but that doesn't change the output.

Any suggestions?

I had this problem in the past (pre 2.3.0) and found a fix but can't remember how I made it work. I'm currently using 3.3.2 beta 1.

Avatar
Bruce B

15 May 2009 at 11:52am Community Member, 145 Posts

The (very crude) fix for this is to strip the XML statement from the start of the feed. In sapphire/api/RSSfeed.php, line 189 is:

echo $body;

I added a new line above to remove the XML declaration:

$body=str_replace("<?xml version=\"1.0\"?>","",$body);
echo $body;

The feed now validates in Feedburner so I am assuming it is valid for the majority of browsers.