OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: Default namespace for attributes?

[ Lists Home | Date Index | Thread Index ]

"Mukul Gandhi" <gandhi.mukul@gmail.com> wrote in message 
> The XML Namespaces Recommendation says that the default namespace
> applies only to elements, and not to attribues
> (http://www.w3.org/TR/REC-xml-names/#defaulting).
> i.e. an unprefixed attribute name will always be in the null namespace.
> I am curious to know why this is so?

It seems to have some reason:

  An attribute belongs to an element and its semantics must be defined as 
part of the semantics of the parent-element. Therefore, additionally there 
is no need to put the attribute in the same namespace as the one of its 

On the other side, if we want to specify on a given element a "special" 
attribute that is not specific only to that element, but is "globally 
defined and owned", then having this attribute in some namespace will serve 
to give the attribute this semantics and be able to distinguish this 
attribute from the attributes that are ("local") specific only for the 
element or from other "global" attributes.

This is how we generally specify such attributes as xml:lang, xml:id, 
xsi:type, ..., etc.

Exactly because local attributes do not belong to any namespace and their 
names do not have prefixes, it is easy to distinguish the global attributes 
whenever they are specified on an element.

So,  my understanding is that one goal of this part of the namespace spec 
was to provide a way of specifying attributes that would be easy to 
understand and that would allow special/global attributes to be seen easily, 
avoiding namespace-prefix clutter altogether.

Dimitre Novatchev
Truly great madness cannot be achieved without significant intelligence.


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS