RE: Why does the default namespace not apply to attributes?

 > Please, don't misunderstand my question; it is absolutely not my
intention to suggest changes to the XML spec, rather my aim is to to find
out what is the rationale for the difference between elements and attributes
with regard to the default namespace. 
 
The rationale, I think, is that attributes normally have meanings and
definitions that are local to the element in which they appear; when that is
the case, putting them in a namespace serves no useful purpose.
 
Of course it's also sometimes true that child elements have meanings and
definitions that are local to the parent element in which they appear; and I
think that's why the XML Schema spec allows the option
elementFormDefault="unqualified". In practice though I think this option is
rarely used and certainly is rarely recommended. The most common practice is
to put child elements in the same namespace as their parents.
 
One could argue this is inconsistent - but if there were no differences
between elements and attributes then there would be no point in XML
providing both.
 
Michael Kay
http://www.saxonica.com/

Received on Monday, 20 August 2007 12:32:06 UTC