Getting the RSS 2.0 namespace right

In the process of demonstrating that splitting a long essay-post into three posts plus an explanation just results in a storm of triply or quadruply duplicated TrackBack pings, Sam Ruby has reproposed adding an optional namespace to RSS 2.0. Good!

Even better, Simon’s taking the blame for it being pulled the first time around, which pleases me no end, since I’ve been feeling guilty about pushing for pulling it, while soft-selling the option of having it be optional with a warning. My proposal for a “if you cause breakage, it’s your own fault” namespace at the time was:

The namespace for the RSS2 core elements defined in this spec is http://backend.userland.com/RSS2. However, authors are cautioned that using that namespace will cause some existing parsers to fail to recognize the resulting document as RSS, and that using it as anything other than the default namespace (i.e., prefixing the RSS
elements) will cause nearly all existing parsers to fail to recognize the document as RSS. Authors are further cautioned that using extensions to RSS that have elements with the same local-name part as RSS2 core elements will cause confusion in existing parsers. Thus, the following is a completely valid RSS2 document which will
be unparsable by virtually every existing RSS parser:


<silly:rss xmlns:silly="http://backend.userland.com/RSS2"
xmlns:foo="http://example.com/foo/">
<silly:channel>
<silly:title>The Title</silly:title>
<foo:title>Not the title</foo:title>

Thus, best practices for RSS2 namespaces are:

  • Use RSS2 core elements unnamespaced in RSS documents, only using the namespace when RSS2 elements are being embedded in an XML document in another format
  • Avoid creating extensions that reuse RSS2 core element local-names in a different namespace

If I were to rewrite that today, I would say something more like:

The OPTIONAL namespace for the RSS2 core elements defined in this spec is http://backend.userland.com/RSS2. Developers of RSS readers SHOULD accept core elements either in that namespace or in no namespace, treating both {http://backend.userland.com/RSS2}title and {}title as an RSS title element. However, authors of RSS feeds are strongly cautioned not to use the namespace in ordinary RSS documents: there are existing readers which will not recognize namespaced RSS 2.0 elements as RSS, and in a document which is known to be RSS, there is no benefit to adding the namespace. It’s only needed when you are embedding RSS elements in another document which requires that every element be namespaced, or one which has so many elements in another namespace that it would be annoying to have to prefix all of them to leave the RSS elements unprefixed. In a nutshell: if you don’t know why you need to namespace your RSS element, then you don’t need to, and shouldn’t.

I still don’t think much of RSS as an interop format (generally, you want to reuse elements from another namespace when they have clear, useful, and well-known semantics which map well to your situation, and RSS doesn’t really, for most of the reuse I’ve seen so far), but doing it that way shouldn’t produce any breakage unless people choose to ignore the spec and do something foolish, and even then, since adding support for it won’t be a very big burden to aggregator authors, it shouldn’t break very many, or for very long. And since Sam wants it, and I now know Sam much better than I did then, it’s quite likely that my remaining reservations are wrong, too.

The only other option that will work for everyone seems to be creating Yet Another RSS Format, and doing it right by our current view of right. That would probably be sort of fun, cleaning up things like exactly what is and isn’t allowed in description, and I think RSS 4.0 is still available (or maybe 5.0), but I doubt that very many people really have the stomach for it. And those that do probably only do because they only know the technical side of RSS, not the social side.

6 Comments

Comment by Doug Ransom #
2003-04-27 09:00:32

Given RSS 2.0 a namespace, we should take the time to roll it into an XHTML module, as the work will be so minimal to integrate these things for even simpler syndication.

Doug

 
Comment by Dan Brickley #
2003-05-10 03:23:19

Having a namespace associated with all elements in RSS 2.0 documents would definitely be a good thing. For those elements that are in RSS 1.0, how about using the RSS 1.0 namespace? Fancier new things that are peculiar to RSS 2.0 could live in their own ns which from an RSS 1.0 perspective would work just as other RSS 1.0 extension modules work.

Comment by Phil Ringnalda #
2003-05-11 13:58:15

In some ways, I quite like using the RSS 1.0 namespace for item/title/description/link. I don’t agree with the people who say that doing so implies that the whole document be a valid RDF/RSS 1.0 document, though I’m certainly not the XML expert to be saying whether borrowing an XML element implies that you are complying with every restriction imposed on the document, or whether borrowing the XML-RDF syntax from an RDF schema implies that you are producing RDF.

However, they aren’t actually a match. If you don’t have any problem with doing RSS 1.0 items, then it works just fine, but an RSS 1.0 item is (title, link, description?) while an RSS 2.0 item is ((title|description), link?) [that’s not right, is it? how do you say ’one or both’?], so you can’t namespace an RSS 2.0 item that consists of a description and link only in an RSS 1.0 item.

 
 
Trackback by dive into mark #
2003-04-23 00:40:58

In brief: insomniac edition

A little of everything. I mean, why not? I’m up anyway.

 
Trackback by Raw Blog #
2003-04-24 02:26:27

Tools rhymes with Fools (RSS 2.0 namespace)

Just for a change I’m not going to comment on the problems of RSS 2.0 itself (or what that a

 
2005-04-21 14:51:58

Getting the RSS 2.0 namespace right

phil ringnalda dot com:

”The
only other option that wil…

 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <del datetime="" cite=""> <dd> <dl> <dt> <em> <i> <ins datetime="" cite=""> <kbd> <li> <ol> <p> <pre> <q cite=""> <samp> <strong> <sub> <sup> <ul> in your comment.