« New build of IE7 is... | Main | Today's links [March... »

FeedsManager.Bastardize()*


OK, I've got the latest IE7 build, the one Microsoft is handing out at MIX06. It took me a bit longer than I had expected to change my examples to compile with the new Feeds API included in the new build. They changed the Feeds namespace to Microsoft.Feeds.Interop and made a bunch of other little changes. So all I have for you tonight is one little example of weirdness.

Let's say you have a feed that uses the RSS 2.0 <description> element to hold a short summary of each item and the funky <content:encoded> element to hold the full content of each item (just like Dave Winer's Wordpress feed does). When the Feeds API reads your feed, it converts it to a normalized (but currently not valid, due to some bugs) form of RSS 2.0 that uses a mix of RSS and Atom 1.0 elements. For funky RSS elements, it uses Atom. So you end up with something like this:

Item contains

<description>
    Short summary of item content
</description>
<content:encoded>
   Full content of the item
</content:encoded>

Feed API normalizes to

<atom:summary type="html">
   Short summary of item content
</atom:summary>
<description>
   Full content of the item
</description>

The old switcharoo, eh?

Here's a more complete example: a source feed in RSS 2.0 format and the same feed in Feeds API normalized normalized format. I've also got an Atom example: source and normalized.

That's pretty weird alright, but they're on the right track. They're using Atom elements to model RSS. Now, if they'd just follow that line of thinking to it's logical conclusion and use Atom as the normalized feed format, they might actually be able to please the assholes and protect the morons of this world.

Tags: topic:[rss], topic:[atom], topic:[feeds], topic:[ie7], topic:[vista], topic:[mix06]

* The title of this post refers to the FeedsManager.Normalize() method which takes an Atom 0.3, Atom 1.0, RSS 1.0 or RSS 2.0 feed and normalizes it to Feeds API RSS 2.0 format. To be clear about this, I'm using this little C# program to get at the normalized feeds:
using System;
using System.Xml;
using System.IO;
using Microsoft.Feeds.Interop;
namespace BlogApps_Chapter06 {
class Normalize {
static void Main(string[] args) {
string url = args[0];
FeedsManager fm = new FeedsManagerClass();
IFeedFolder rootFolder = (IFeedFolder)fm.RootFolder;
IFeed feed = null;
if (!fm.IsSubscribed(url)) {
feed = (IFeed)rootFolder.CreateFeed(url, url);
} else {
feed = (IFeed)fm.GetFeedByUrl(url);
}
feed.Download();
string xml = feed.Xml(feed.itemCount,
FEEDS_XML_SORT_PROPERTY.FXSP_PUBDATE,
FEEDS_XML_SORT_ORDER.FXSD_ASCENDING,
FEEDS_XML_FILTER_FLAGS.FXFF_ALL,
FEEDS_XML_INCLUDE_FLAGS.FXIF_CF_EXTENSIONS);
StreamWriter sw = new StreamWriter(File.OpenWrite(args[1]));
sw.Write(xml);
sw.Close();
}
}

}
Comments:

Hi Are you saying MSFT is moving to support Atom and that the common RSS platform is potentially an Atom 1.0 implementation? thanks Sam

Posted by Sam Sethi on March 21, 2006 at 02:39 PM EST #

The Windows RSS platform already fully supports Atom 0.3, Atom 1.0, RSS 1.0 and RSS 2.0 feeds.

What I'm suggesting is that Microsoft should use Atom format as their normalized feed format instead of using the crazy mish-mash of RSS and Atom that they now use. Atom can safely model anything in an RSS feed, but I don't believe the reverse of that is true.

Posted by Dave Johnson on March 21, 2006 at 02:51 PM EST #

Interesting. I did something similar with FeedTools, but it's more abstract and flexible. Once you load a feed, you can call the build_xml method. By default, it will regenerate the feed back into the same format it was in originally, but normalized and cleaned up. But it also offers you the option to specify a feed format when you call build_xml. Makes it really easy to pull in a bunch of feeds, manipulate them however you like, and spit them back out in whatever format you want.

Posted by Bob Aman on March 21, 2006 at 05:05 PM EST #

Post a Comment:
  • HTML Syntax: NOT allowed

« New build of IE7 is... | Main | Today's links [March... »

Welcome

This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog

Related entries

Below are the most recent entries in the category Microsoft, some may be related to this entry.