Posted on 19 December, 2010 under Technology with Post a Comment
During the last few weeks, I have been having problems with the feeds from most of blogs, they were all broken, whenever I try to view them in, whether in ‘Chrome‘, ‘Firefox‘ or ‘Internet Explorer‘ they all return with an error
‘error on line 2 at column 6: XML declaration allowed only at the start of the document‘ in Chrome or ‘XML Parsing Error: XML or text declaration not at start of entity‘ in Firefox. I was really concerned about this because if the feed for a blog doesn’t work, then subscribers won’t get daily update in their emails nor via a RSS reader.

Because of this problem, I was searching the entire World Wide Web for a solution. I later found out that the problem is caused by a whitespace before an XML declaration (<?xml … ?>) in your feed. Basically there is a blank line before your starting php tag, which can be caused by installing a new Theme, a Plugin or any even messing with configuration file.
Solution: Start looking of blank space in the PHP starting tag your pages (<?php) and also after the closing tag (?>) as well. Pages to start with includes functions.php in your theme folder as well as files in your root folder including feed.php, wp-config.php, wp-atom.php and wp-rss2.php
1. The problem could also be caused by a plugin, so you can start by deactivating each plugin individually and checking the feed. If none of the plugins were the problem, reactivated them all back.
2. Editing each of the pages listed above, look for a blank space at the bottom after the closing of the PHP tag or at the beginning at the starting PHP tag (see illustration on diagrams below).


Finally, after you have fix the error ‘error on line 2 at column 6: XML declaration allowed only at the start of the document‘, ‘XML Parsing Error: XML or text declaration not at start of entity‘, then log into your Feedburner account and Ping your account so your feed can be updated.
Account > Troubleshooting > Ping Feed