[XML-SIG] Default namespaces, attributes, 4DOM and the W3C recommendation

paul@boddie.net paul@boddie.net
27 Sep 2001 09:20:58 -0000


On Thu, 27 Sep 2001 08:08:39 +0200 "Martin v. Loewis" <martin@loewis.home.cs.tu-
berlin.de> wrote:
>
>It is certainly possible to infer the meaning of an attribute without
>namespace from the parent element. However, this cannot be done in a
>general way; it is always application specific.

I can see the occasional need for "annotating" elements with attributes which 
are not associated with the namespace of the elements in question. However, the 
specification seems to imply that all unprefixed attributes are always going to 
be application specific in some way. Personally, if I wanted to use attributes 
in this way, I would at least associate them with a namespace to indicate that 
they mean something well-defined.

Of course, by not using unprefixed attributes at all, it does mean that one can 
know what an attribute means by a casual inspection of a document, but if 
default namespaces are in use then one cannot do the same for elements. I'm 
just not convinced by the need for this lack of consistency.

[...]

>> Right now, I have to mandate that the XMLForms namespace be the
>> default namespace in a document, because the above issue made it
>> unclear how one should properly handle cases such as those I gave in
>> my examples. It would be great, for a number of reasons, to remove
>> this restriction.
>
>If you consider this desirable, you may want to reconsider whether
>namespaces are a good thing in the first place. In XML namespaces, you
>really have to have a namespace on each element. Whether this happens
>by means of a default namespace, or by means of tagging each element
>with a namespace, are your only options.

Namespaces *are* a good thing in my particular application since there would be 
no decent way of using elements from different document types otherwise. My 
confusion arose when considering the behaviour or meaning of default 
namespaces - since the default namespace applies to all unprefixed elements, 
and as a result an element cannot (or should not) occur without being 
associated with a particular namespace, it seems bizarre to the casual observer 
that a loophole exists which permits attributes to escape such constraints.

>If inconvenience is a reason: it is common to pick a single-letter
>prefix, e.g. "f" if you have to type it frequently.

I'm not as concerned with convenience as with the need for the relationships 
between attributes and namespaces to be clear to me and to anyone who might 
want to use my application. It seems perverse that despite a sizeable 
specification (aren't all the W3C's specifications huge?) one only finds decent 
answers to fundamental questions in some mailing list archives after doing a 
Web search.

Anyway, thanks for the feedback! Perhaps I should go and rant in more official 
circles about this. They have probably heard this a thousand times before, 
although I can't say I would be surprised about that.

Paul

-- 
Get your firstname@lastname email for FREE at http://Nameplanet.com/?su