Posts Tagged ‘feeds’

Invalid RSS Feeds

Posted in PHP on November 12th, 2009 by Jon – Be the first to comment

I created a simple feed parser for Solar the other day. I am using this on our corporate Intranet. It works pretty well so far and uses Solar_Cache to periodically store the data for fast retrieval. The parser uses PHP’s SimpleXMLElement. Today I found a feed that wasn’t showing up properly. After some digging, it turned out that it was because the feed itself was not valid; it had extra content after the closing rss tag. The last bit of content looked like some sort of stats tracking image and some comments. Invalid RSS feeds are too common, IMHO. The problem is, that the tools we use to parse the feeds get stuck with the job of finding workarounds to the invalid feed data. What would be better is if more people complained that the feeds were invalid, forcing the author to fix them. This would make building simple feed readers a whole lot easier.