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


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] namespace inheritance

[ Lists Home | Date Index | Thread Index ]

To quibble slightly, the namespaces recommendation does not define a 
"global namespace". By this term, I assume you mean the set of all 
unprefixed element names. But even if this is the case, unprefixed 
attribute names are, by definition, not in this set.

This tends to upset people, since they want all names to be in a 
namespace. However, if you remember that the point of the namespaces 
recommendation is to allow people and programs to uniquely identify 
element and attribute names rather than to construct "namespaces", this 
makes sense.

In particular, since attributes are associated with elements, the 
uniqueness of the element names is sufficient to uniquely identify the 
attributes. That is, I can tell the difference between the following foo 
attributes because I can tell the difference between the p1:bar and 
p2:baz elements:

    <p1:bar xmlns:p1="ns1" foo="foofoofoo" />
    <p2:bar xmlns:p2="ns2" foo="foofoofoo" />

(The whole point of being able to prefix attribute names is precisely 
the opposite -- so I know that they are the same.)

-- Ron

Amelia A Lewis wrote:

> Attributes live in the global namespace by default; they do *not* inherit
> the default namespace, unlike elements.  Therefore, your first example above
> defines the result you show, and the second defines:
> <{ns:ns:ns}elem {}attr="smth" />
> The only way to get an element in a namespace is to put it there; an
> attribute without a prefix is always in the global (unnamed) namespace.
> This usually confuses people, because it isn't the way that elements behave. 
> It is, however, what the namespaces specification defines.


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

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