Re: xmlns attribute namespace

Garret Wilson wrote:
[...]

> That almost seems straightfoward, until one reads the first example of
> "Namespaces in XML", "A.3 Expanded Element Types and Attribute Names":
> 
> <!-- 1 --> <section xmlns='urn:com:books-r-us'>
> <!-- 2 -->   <title>Book-Signing Event</title>
> <!-- 3 -->   <signing>
> <!-- 4 -->     <author title="Mr" name="Vikram Seth" />
> <!-- 5 -->     <book title="A Suitable Boy" price="$22.95" />
>              </signing>
>            </section>
> 
> The document claims that the names would expand so that:
> 
> 5 title <ExpAName name='title' eltype="book" elns="urn:com:books-r-us" />
> 
> This seems to be saying that the <book> "title" attribute takes on the
> default namespace of "book".

Unless I am missing something here, title is clearly an element, not an 
attribute, which makes it participate in the default namespace.

> The first example in the "XML Schema Part 0: Primer" document seems to
> uphold this notion:
> 
> <xsd:schema xmlns:xsd="http://www.w3.org/2000/08/XMLSchema">
> [cut]
>  <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
> 
> If attributes do not take default namespaces, then how can the "name"
> attribute of <xsd:element> be validated to the definition of the schema for
> namespace http://www.w3.org/2000/08/XMLSchema ? Is the example incorrect,
> and each attribute should be prefixed by "xsd:"?

I think I missed a point here somewhere or something in the example.  
Attributes are typically defined and interpreted in the context of the 
element they are defined for.  I would interpret not having a namespace 
qualification is akin to a local definition.  I believe that schema goes 
a step beyond DTDs and even allows local child element declarations, but 
attributes are thought of as local to an element.  My own practice is to 
only add namespace URIs to attributes which transcend the particular 
element, which have a definition understood outside of the particular 
element accross many and perhaps even all elements, a little like the 
concept of SGML architectural forms.

Ray Whitmer
rayw@netscape.com

Received on Thursday, 21 December 2000 13:44:56 UTC