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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

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

rss feed code error...


Go to End


8 Posts   4859 Views

Avatar
burgessb

Community Member, 17 Posts

6 February 2009 at 4:41pm

Edited: 06/02/2009 4:53pm

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.

Avatar
Nivanka

Community Member, 400 Posts

10 February 2009 at 7:25am

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

Avatar
badjedi

Community Member, 25 Posts

11 December 2009 at 11:33am

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?

Avatar
Willr

Forum Moderator, 5523 Posts

11 December 2009 at 8:08pm

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.

Avatar
Bruce B

Community Member, 164 Posts

19 January 2010 at 3:57pm

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

Avatar
Goutami

Community Member, 1 Post

17 June 2010 at 12:51am

Edited: 17/06/2010 12:54am

Thanks Bruce B,

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

Avatar
TomG from Squashed Pixel

Community Member, 6 Posts

29 July 2010 at 5:21am

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

Avatar
inCharge

Community Member, 102 Posts

27 May 2011 at 3:47am

Edited: 27/05/2011 7:36am

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 ?>