[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Namespace: what's the correct usage?
- From: Tim Bray <tbray@textuality.com>
- To: xml-dev@lists.xml.org
- Date: Tue, 22 May 2001 06:16:04 -0700
I was reading through this thread with interest, and could see
both sides of the argument, but find myself swinging more and
more strongly one way.
At one level, what's going on in the following is pretty
obvious and natural:
<xx:family xmlns:xx="some-namespace">
<address> ... </address>
<children>
<son>Rob</son>
<daughter>Sally</daughter>
</children>
</xx:family>
And I'm sure there are large classes of applications that
will Do The Right Thing. But the more I think about this,
the more I believe that this is probably pretty bad
practice.
XML 1.0 and Namespaces between the two of them provide a
simple-minded, automated way for any software module to
decide whether it ought to be interested in a particular
element or attribute.
In the example above, the software would do this in a way
that's equally straightforward and automated but not
generally blessed. And it is subject to breakage, in the
case that someone else combines this with markup from
another namespace, e.g.
<xx:family xmlns:xx="some-namespace">
<address> ... </address>
<children>
<son>Rob</son>
<daughter>Sally</daughter>
</children>
<video-note xmlns="http://videomat.fr">
<son>plusieurs violoncelles</son>
<lumiere>jaune, d'en haut</lumiere>
</video-note>
</xx:family>
Or suppose <video-note xmlns= is a *parent* of
<xx:family>. Either way potentially causes breakage
among software that simply follows the XML+namespaces
rules as written.
The only good counter-argument is "I don't
plan to have my markup used that way". Well OK, but
that kind of reminds me of the people who used to say
"16 bits of addressing is all I'll ever need" or "we'll
just use ASCII, we'll never have to do kanji" or
whatever, in a Web whose basis is its open-endedness.
It seems silly, when just using namespaces throughout
pretty well guarantees interoperation with anyone else's
markup [assuming they play by the rules too].
I just don't see that the admirable simplicity of the
first example above is quite pleasing enough to justify
the cost, which is considerable. -Tim