RSS namespaces and ISO 8601: airing out the laundry

I was relieved to see Joshua Allen's remarks on the namespace issues that RSS 2.0 has stirred up:

The discussion over namespaces in RSS 2.0 is turning out to be a very instructive study for those of us who build XML infrastructure, training courses, and products for developers. I hope that anyone who makes a living catering to XML developers is paying attention. [ Better Living Through Software ]

So, it's not just me! About a week ago, as a result of discussions with Sam Ruby, Tim Bray, and others, I realized I had to withdraw the default namespace declaration from my RSS feed. Concrete examples are hard to come by in this often-abstract discussion, but I've got one. The alternate "long-descriptions" version of my feed runs through the W3C's XSLT service , which uses James Clark's XSLT processor, XT. When I added xmlns="http://backend.userland.com/rss2" to my feed, this transform broke. I checked and got the same result using Microsoft's MSXML.

At this point I began to understand why Sam and Tim had been suggesting that RSS2 might want to fully qualify its namespace declaration and elements. I had thought an XSLT stylesheet, on transforming a feed declaring a default RSS2 namespace as RSS2 originally specified, would match and select unprefixed elements. It doesn't. If the XML document puts elements in a namespace, XSLT has to be able to match and select using that namespace explicitly.

Should XSLT have done otherwise? Beats me. In any case, I found empirically that an RSS2 feed with fully qualified elements, like so:


<?xml version="1.0" encoding="utf-8"?>
<rss2:rss version="0.92"
xmlns:rss2="http://backend.userland.com/rss"
xmlns:content="http://purl.org/rss2:rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rss2:channel>
<rss2:description>Jon Udell's Radio
Blog</rss2:description>
<rss2:link>http://weblog.infoworld.com/udell/
</rss2:link>
<rss2:title>Jon's
Radio</rss2:title>
...


was compatible with an XSLT stylesheet that matches and selects fully qualified elements, like so:


<?xml version="1.0"?>
<xsl:stylesheet
xmlns:rss2="http://backend.userland.com/rss"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="rss2:rss">
...


I made this change, and all seemed well...at first. Radio could subscribe to the feed, XSLT could transform it. But some other folks -- Ziv Caspi, Sjoerd Visscher -- reported errors. When I went back and checked, I found the problem. Radio only mostly worked with this format. When I posted an item with a <category> element, Radio barfed.

At this point, I withdrew the default namespace declaration, just as Dave recently did in Radio's standard RSS writer. If Radio were to emit the fully-qualified style (and, of course, could also consume it), would the other problems that were reported go away too? Perhaps not. Simon Fell suspects that "aggregators that haven't needed any changes to work with RSS2.0 aren't handling namespaces properly, and the localName clash tests will trip them up."

As Joshua says, it's all been very instructive. The bad news is that a lot of dirty laundry has been hung out. The good new is that it's being exposed to the open air. I suspect (though I can't prove) that RSS is the most popular, widely-used application of XML. Figuring out how to use namespaces in RSS is going to be good for the RSS community, and good for XML.

As it stands, my RSS feed is using other namespaces (dc:, content:) but not an explicit rss2: namespace. So far as I know, these other namespaces are causing no problems. If that's wrong, please let me know. Actually, while we're airing laundry, I have heard one complaint. I'm emitting <dc:date> elements like so:

<dc:date>20020925T10:03:00</dc:date>

It was suggested to me that the format should instead be:

<dc:date>2002-09-25T10:03:00-05:00</dc:date

As I explained here , I'm getting my date format from Radio's dateTime.iso8601 function (which corresponds to the style shown in the XML-RPC spec). I can of course not use dateTime.iso8601 and just produce the other format directly. But, I got to wondering what the deal is with ISO 8601. I did some poking around , and it seems there are a bunch of valid ISO 8601 formats. When I tried to go to the original spec , though, I landed in a shopping cart. Is ISO kidding? Evidently not.

Unfortunately, you cannot download your own copy of the latest version of the standard unless you pay some money to ISO. Seems pretty daft to me - if you want a worldwide standard to be adopted it should be freely available to everyone who could possibly want to use it. [ International Date Format Campain ]

Sheesh. ISO 8601 makes the namespace controversy look like tempest in a teapot.


Former URL: http://weblog.infoworld.com/udell/2002/09/30.html#a427