Really Stupid Atom Support03 Jan 2004
(for Magpie RSS 0.52 and Feed on Feeds 0.1.1). Many blogs are already sporting Atom 0.3 feeds, and some have even declared their RSS to be deprecated. So I decided to try to bolt Atom support onto my aggregator of choice. It turned out to be pretty easy, requiring patching just 2 files.
However, my approach is very simplistic, simply representing Atom items in Magpie such that FoF can understand and display them. I'm sure that Kellan and Steve will eventually fully support Atom feeds. But until they do, here is the patch to init.php and parse_rss.inc. I thought about calling it 'Really Stupid Support for Atom', but the acronym 'RSS for Atom' would have confusing to say the least.
- Magpie will parse anything that remotely resembles RSS without bothering to validate it. While RSS is a 'channel' containing several 'items', Atom is a 'feed' containing several 'entries'. So I just told magpie to treat a 'feed' as a channel and an 'entry' as an item.
- Magpie doesn't parse XML attributes at all. However, 'links' in Atom are defined purely as attributes, and each 'feed' or 'entry' can have several links, while in RSS a 'link' is simply a string. So I had Magpie create an array of items for each link.
- I then told FoF about the new elements in the array, for example to use the 'tagline' for the 'description' if it exists. I also wrote a function for FoF to select the first appropriate link if the link is an array instead of a string.