I hate XML Namespaces. Its ugly and difficult to grep (pun intended). Its also makes hand coding XML difficult since one has to remember those namespace URIs. There can be no defense for XML Namespaces, for the controversies over it can not be denied. While RSS 2.0 introduces XML Namespaces into RSS, I intend to present a simpler approach that does not use XML Namespaces.
In RSS, there are two areas where extensions are most likely, inside <channel> and inside <item>. To support extensions in these two areas, we introduce three rules:
- RSS parsers must ignore unknown tags.
- Unknown RSS tags are opaque – this means you cannot enumerate its children.
- Encapsulate custom tags inside a tag whose name starts with domain name.
Here is an example:
<channel>
…
<com.docuverse.daily.tags>
<title>semantics of extension tags are context sensitive.</title>
</com.docuverse.daily.tags>
<item>
…
<org.slashdot>…</org.slashdot>
</item>
…
</channel>
This approach to extensions can easily be manipulated using simple regular expression based tools. Its easy to read and write. Its namespaces done right. Its a solution that is willing to sacrifice that problematic 20% in return for simplicity.