Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Pete Cordell" <petexmldev@--------------.--->
To: "Michael Kay" <mike@--------.--->, "'Nanda Kol'" <nandakol@-------.--->
Date: 8/20/2007 7:33:00 PM
Here's my stab at answering this...

The main component of an XML file is an element.  And the main part of an 
element is the text part (e.g. as in <myElement>Text</MyElement>, although 
the text can obviously contain additional mark-up).  The text part is in 
effect an anonymous, and hence namespace-less, parameter of the element. 
The attributes are adjective-like annotations, often specifying how the 
element, and in particular the text part, should be interpreted or rendered 
etc.  As they are specific to the element/text part of the element, it makes 
sense that they are locally scoped and hence don't need namespaces.  The 
elements on the other hand could, in theory, be mixed and matched in any 
order, possibly from a number of vocabularies.  Hence namespaces are helpful 
on elements to tell <a:name/> from <b:name> etc.

> 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.

Arguably not the best justification I've seen for attributes :-)  (Although 
possibly mine is no better!)

HTH,

Pete.
--
=============================================
Pete Cordell
Codalogic
for XML Schema to C++ data binding visit
 http://www.codalogic.com/lmx/
=============================================

----- Original Message ----- 
From: "Michael Kay" <mike@s...>
To: "'Nanda Kol'" <nandakol@h...>; <noah_mendelsohn@u...>
Cc: <xmlschema-dev@w...>
Sent: Monday, August 20, 2007 1:31 PM
Subject: 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/
>
> 



From hajduk@i... Mon Aug 20 21:17:54 2007
Received: from wiggum.w3.org ([128.30.52.23])
	by frink.w3.org with e


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent