Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » rss feed code error...

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 3441 Views
  • burgessb
    Avatar
    Community Member
    17 Posts

    rss feed code error... Link to this post

    In my forum and blog, when I click on the RSS feed button in IE, I get a page error that says that there is a "Feed code error."

    My rss widget can pick up the feed, and IE obviously detects some sort of feed. When I click on the "More Information" link in the error page, it says:

    XML document must have a top level element.
    Line: 0 Character: 0

    Does anyone have an idea of how to fix this?

    Thank you for your time.

  • Nivanka
    Avatar
    Community Member
    395 Posts

    Re: rss feed code error... Link to this post

    view the source and check whether you get anything there, then save that as a XML file and open it and see.

  • badjedi
    Avatar
    Community Member
    25 Posts

    Re: rss feed code error... Link to this post

    I am having this same error it appears to be some white space that is in the top of the rss feed generated by the blog module.

    Here is the link to the rss feed made by the blog module : http://www.arena-snowparks.com/news/rss

    it has three lines of white space above the xml declaration.

    Does any one have any ideas to fix that?

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: rss feed code error... Link to this post

    badjedi - you likely have some whitespace after a closing '?>' tag (might want to check the RSSFeed.ss template to make sure its just not space in there).

    Usually you'll just have to go through your code files and double check the ?> is the last thing - no whitespace, no spaces. I prefer removing the whole ?> at the end as its not required and it means issues like this don't crop up.

  • Bruce B
    Avatar
    Community Member
    145 Posts

    Re: rss feed code error... Link to this post

    I was having this problem and just could not find the file with the offending white space. In the end I just deleted the XML declaration line at the top of sapphire/templates/RSSFeed.ss.

    After that it validated happily and everything seems to work. I'm not aware of any issues arising from deleting the XML declaration.

    cheers
    bruce

  • Goutami
    Avatar
    Community Member
    1 Post

    Re: rss feed code error... Link to this post

    Thanks Bruce B,

    Your solution is working. I removed xml version="1.0" from RSSFeed.ss and now it is working

  • TomG from Squashed Pixel
    Avatar
    Community Member
    6 Posts

    Re: rss feed code error... Link to this post

    Bruce, you're a lifesaver, been banging my head against the wall for far to long when I stumbled across your solution, cheers

  • inCharge
    Avatar
    Community Member
    102 Posts

    Re: rss feed code error... Link to this post

    Both Will & Bruce's solutions work, but Will's is the 'correct' one...

    1) because if core code is changed, when it is upgraded, the same changes must be made again. Changes to core code need to be carefully tracked to make sure they are not lost at the next upgrade.

    2) because removing the XML declaration invalidates the file format, even if your browsers/reader can cope with it.
    http://www.w3.org/TR/2008/REC-xml-20081126/#sec-prolog-dtd
    "XML documents SHOULD begin with an XML declaration which specifies the version of XML being used."

    The simplest solution is to remove ?> from the end of ALL php files.

    >> ...could not find the file with the offending white space.

    Just search for files under mysite containing ?>

    3441 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.