[
Lists Home |
Date Index |
Thread Index
]
Paul Prescod wrote:
> Joe Gregorio wrote:
>
>> .... The
>> basic idea being that if the document is going to stand alone then no
>> namespace qualification is needed. If it is going to be combined or
>> contained
>> in other vocablaries then the namespace is applied. For a concrete
>> example consider RSS 2.0[1], in which the native RSS elements reside
>> in the nil
>> namespace:
>>
>> <rss version="2.0">
>> <channel>
>> <title>...
>
>
> This could be written:
>
> <rss version="2.0" xmlns="http:../rss">
> <channel>
> <title>...
>
> It is just a few more characters per document and NO prefixes.
Well there you go. It's cheap to produce an XML document with xmlns.
I doubt it's so cheap to receive it. And in some cases, the prefixes
are there anyway on the receiving end. But you know already know this.
> It also
> makes the document more self-describing and provides a built-in link to
> the documentation page. What's not to love?
Exactly how is this 'more self-describing'? And the built in link -
well that's not what namespaces are for (explicitly so) and it's
hardly the optimal way to associate documentation or semantics with
an enumeration of names, given the overhead imposed elsewhere.
Indeed it's possible that namespaces are fundamentally broken in
both regards. What am I missing?
>> I have also run into such a need in other cases, for example
>> I have worked with a group that is, at best, namespace allergic.
>
>
> Anybody who is so namespace allergic that they cannot add a single
> "xmlns" attribute to their document is, in my opinion, trying to make
> life difficult for others, not trying to make life easy for themselves.
Nah, and quite the opposite, anybody who adds an xmlns attribute is
making life easy for themselves, not others. I'm with Joe English,
namespaces are simply the wrong side of the cost/benefit curve. My
consistent experience is that any theoretical savings in having XML
elements masquerading as pseudo-URIs is amortized by having to
manage the code that process against the namespace+prefix. In
particular they screw up programmatic use of XPaths by stopping the
XPaths being freestanding - of course you could argue that's XPath's
fault for choosing to use devices of no semantic import in the
syntax instead of the URIs actually present in the model. The again
this:
/soap:Envelope/soap:Header
is probably an easier sell than this:
/{http://schemas.xmlsoap.org/soap/envelope/}Envelope/{http://schemas.xmlsoap.org/soap/envelope/}Header
Until you give a cursory though about how best to manage the prefixes.
And the thing this is that namespace don't seem to convenience
programmers at all - I understand this was a reason for inventing
them. As a programmer, I ultimately don't want to have deal with
namespaces because I don't want to have deal with the moral
equivalent of pointers - you end up hacking out some kind of bizarro
XML+classes vtable to manage the URI shortcodes.
The simple addition of an xmlns is a device for turning this:
<Envelope>
<Header/>
<Body>
<rss version="2.0">
<channel>
<title>...
into this:
<{http://schemas.xmlsoap.org/soap/envelope/}Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
<{http://schemas.xmlsoap.org/soap/envelope/}Header/>
<{http://schemas.xmlsoap.org/soap/envelope/}Body>
<rss version="2.0">
<channel>
<title>...
what's to love about that? [but see below]
> An XML document should have either a DOCTYPE or a namespace declaration
> to anchor itself in no global namespace. And even if you have a DOCTYPE
> it can hardly hurt to have a single namespace attribute on the root
> element (or perhaps defaulted from the DTD).
An XML document should be understandable by what's about to process
it. I see no nothing to suugest namespaces and the consequent
prefixing hack are beneficial in that regard.
In fact I'd rather work with this:
<{http://schemas.xmlsoap.org/soap/envelope/}Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
<{http://schemas.xmlsoap.org/soap/envelope/}Header/>
<{http://schemas.xmlsoap.org/soap/envelope/}Body>
<rss version="2.0">
<channel>
<title>..
than this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
<soap:Header/>
<soap:Body>
<rss version="2.0">
<channel>
<title>...
at least it'd be clear what I was actually programming against
(RDF), plus the vtables would thankfully be up in smoke.
Bill de hÓra
|