The RSS Blog

News and commentary from the RSS and OPML community.

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.

https://rssweblog.com/Usm.aspx?xml=https://rssweblog.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/", "https://rssweblog.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":