XML Feed Finally Validating

Written by

in

I just fixed one of the most confounding problems I’d ever come across on WordPress, so I’m sharing how I did it because I definitely couldn’t find the solution after weeks of trying.

See I was trying to get the valid XML feed for a particular Tag or Category from this blog, a process I’ve instigated on PLUG’s mailing list, so that the PLUG website can aggregate feeds tagged as ‘plug’ or ‘open source’ or ‘foss’ voluntarily submitted by its (currently 130+ strong) membership.

The problem was when I try to get the feed URL, for example:

http://www.lefthandedlayup.com/index.php/tag/plug/feed

I get this error:

XML Parsing Error: xml declaration not at start of external entity
Location: http://www.lefthandedlayup.com/index.php/tag/plug/feed
Line Number 2, Column 1:

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

After weeks of searching and asking at the WordPress Forums to no avail, I’ve finally tried validating at Feedvalidator, which recommended amongst other things, I check my wp-rss2.php.

And there I found it. What looks like this:

should be like this:

In short, remove the spaces on line #9 on your wp-rss2.php. Now it’s validating. Check it here.

Can’t wait to apply it on the other sites. Basketball Exchange, in particular, has got XML errors up the wazoo.