Universal Subscription Mechanism, Part Deux - The RSS Blog
Really Simple Syndication
 
Copyright 2003-4 Randy Charles Morin
The RSS Blog
<< Previous Main Next >>
Fri, 14 Jan 2005 19:49:46 GMT
Universal Subscription Mechanism, Part Deux

Further to my Universal Subscription Mechanism posts earlier, I have created a URL that allows anybody to return the correct media type with the RSS link module extension to tell the client shell extension where to find the subscription URL. Here's my RSS feed, with the appropriate HTTP header and RSS link module element.

Note two relevant changes from my original feed.

  1. The returned Content-Type is application/rss+xml. instead of text/xml. You can view the headers with RSSSpy.
  2. The channel level RSS link module element.

You can see how your feed should look for Universal Subscription to work. Simply replace everything after the xml= in the following URL with your own feed URL.

http://www.therssweblog.com/Usm.aspx?xml=http://www.therssweblog.com/rss.xml

Also, I'm looking for feedback, typos, blatant errors. Thanks!

And here's the code that does the transformation. I'd love to see this in Python and PHP.

System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(uri);
if (doc.DocumentElement["channel"]["http://purl.org/rss/1.0/modules/link/", "link"] == null)
{
   System.Xml.XmlElement element = doc.CreateElement("l", "link", "http://purl.org/rss/1.0/modules/link/");
   element.SetAttribute("rel", "http://purl.org/rss/1.0/modules/link/", "http://www.therssweblog.com/usm.html");
   element.SetAttribute("type", "http://purl.org/rss/1.0/modules/link/", "application/rss+xml");
   element.SetAttribute("title", "http://purl.org/rss/1.0/modules/link/", "Subscribe");
   System.Xml.XmlAttribute attribute = doc.CreateAttribute("rdf", "resource", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
   attribute.Value = uri;
   element.SetAttributeNode(attribute);
   doc.DocumentElement["channel"].AppendChild(element);
}
Response.ContentType = "application/rss+xml";
doc.Save(Response.OutputStream);

Reader Comments Subscribe
Type "339":
Top Articles
  1. Unblock MySpace
  2. MySpace
  3. FaceParty, the British MySpace
  4. del.icio.us and sex.com
  5. Blocking Facebook and MySpace
  1. Review of RSS Readers
  2. MySpace Layouts
  3. RSS Stock Ticker
  4. RSS Gets an Enema
  5. Google Reader rejects del.icio.us