« CLR Reliability | Main | Stupid user admits inability to install java 1.4.2 »

Namespaces: what am I missing?

Extending RSS 2.0 With Namespaces

It's obvious that his definition of <banking> (how a plane moves through the air) is different than your definition of <banking> (what bank you place transactions at). This is an example of "breaking your father's back" - since you didn't put your toys in your toy chest, problems are occurring. How are your readers supposed to know which <banking> is being talked about? Airplanes or financials? That's where namespaces come in.

The proposed solution (sans xmlns declarations):

 <item>
  <title>A simple example</title>
  <description>A simple example</description>
  <airplanes:banking>Turn the rudder 45 degrees to the left.</airplanes:banking>
  <financial:banking>Bank of Montreal</financial:banking>
 </item>

The conclusion:

The benefit for a piece of software is immediate: it now knows that one sort of banking is different than another sort of banking. There was no way it could tell this without namespaces. Note that I've used meaningful names above, but you don't have to - you could easily have used < blah:banking> and < flintstones:banking> . To software, the difference would still be relevant, but it merely makes things more confusing for human readers of your RSS feed.

Yes, it's obvious that banking is different from banking. No, I never see standalone xml tags like banking in the wild, they're always part of a vocabulary. If I did see a a lone tag in the XML wild, my first reaction is, why is that thing there? not, to paraphrase Marcus Aurelius, to ask what is it in itself? And certainly not to make assumptions about what computers do and don't know.

Such tags are called children for a reason, they belong with their parents. It's this kind of noddy example that perpetuates the myth that namespaces are somehow neccessary for XML in the same way <getStockQuote /> perpetuates the myth that RPC is somehow neccessary for SOAP. They're not.

As for the do's and don'ts. Forget about human readable prefixes, prefixes are incidental creatures and can't be guaranteed to roundtrip or preserve through a series of XML engines - unless you;re using XPath, prefixes are a syntactic hack that arose because XML can't embed URIs in element names.

Using namespaces, it seems you can dodge name clashes. I'm saying, when you're ready, you won't have to.


June 28, 2003 05:32 PM

Comments

Trackback Pings

TrackBack URL for this entry:
http://www.dehora.net/mt/mt-tb.cgi/1018

Listed below are links to weblogs that reference Namespaces: what am I missing?:

» Namespaces and RSS2.0 from The Fishbowl
The problem that Namespaces were introduced into RSS to solve was: lots of different people want to add their own custom extensions to RSS. Since RSS is such a small domain, the chances of two people coming up with identical tags with different semanti... [Read More]

Tracked on June 29, 2003 11:27 AM

» The need for namespaces from Raw Blog
Bill, I agree that namespaces aren't the only way of avoiding clashes, but I do think they're probably the easiest... [Read More]

Tracked on June 30, 2003 06:55 PM