WordPress Feed XML Parsing Error, solved!

UPDATE

The solution mentioned originally did work for a few days and it went back to the same error. In desperate attempts, I removed everything and reinstalled WordPress. When that didn’t change anything, I moved everything from http://blog.xnepali.com to http://xnepali.com/movies. Well, that was the ultimate measure I could have done. But, to my unpleasant surprise, the RSS error was still there.

It was so frustrating that I choose to ignore the error and continue as it was. Then, one fine day, I started trying to redo everything – removing all the plugins, changing themes and so on. I wasn’t hopeful but it was worth a try.

Then I stumbled upon a suggestion that worked !!

All I did was add 3 lines in two files – wp-includes/feed-rss2.php and wp-includes/feed-rss2-comments.php

$out = ob_get_contents();
$out = str_replace(array(“n”, “r”, “t”, ” “), “”, $input);
ob_end_clean();

It is working now and I hope this is a bit more permanent solution.

***original post***

When I got the following error in xnepali blog, I went searching for the solution in the internet.

=======
XML Parsing Error: XML or text declaration not at start of entity
Location: http://blog.xnepali.com

Line Number 2, Column 1:

<?xml version=”1.0″ encoding=”UTF-8″?>
^
=========listening

feed-I was told to “remove any blank lines at the top or bottom.” To my surprise, almost every php files had a blank lines at the bottom. I don’t know what caused that. I tried removing the blank lines files containing “functions”, “RSS”, and “feed” in the name.

After 1 hour of “hard work” I was till at the place I started. The error was still there. Then,I cam across a WordPress support thread. There was a person with problem similar to ours. The solution worked for me too.

What worked for GaryWhite855 worked for me too:
http://wejn.org/stuff/wejnswpwhitespacefix.php.html

Looks like, the small php file removes whitespaces in php to solve the feed problem. I hope this information will be useful to those who face similar problem with the RSS feed of WordPress.

Advertisement

One thought on “WordPress Feed XML Parsing Error, solved!

Leave a Reply

Your email address will not be published. Required fields are marked *