Jump to:

23355 Posts in 17838 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » space before XML invalidates feedburner feed

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

Page: 1
Go to End
Author Topic: 1181 Views
  • Bruce B
    Avatar
    Community Member
    145 Posts

    space before XML invalidates feedburner feed Link to this post

    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.

  • Bruce B
    Avatar
    Community Member
    145 Posts

    Re: space before XML invalidates feedburner feed Link to this post

    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.

    1181 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.