Re: Draft #1 response re: XML attributes and namespaces

On Thu, Aug 04, 2011 at 12:18:52PM -0400, Grosso, Paul wrote:
> Below I excerpt the original message and then provide my draft response.
[...]
> 
> Summary
> -------
> Attributes do not inherit namespaces.  Unprefixed attributes are not
> in any namespace (in the W3C/XML sense of namespace).  Therefore,
> attributes never inherit the default namespace.
> 
> Details
> -------
> Namespaces are never inherited.  The word "inherit" does not appear
> in the namespace specification.  Namespace *declarations*--which
> associate a namespace prefix with a namespace name (URI)--are scoped
> by the element on which they occur.  The in-scope namespace declaration
> at the point of any *prefixed* element or attribute determines the 
> namespace of that prefixed element or attribute.[1]
> 
> The in-scope default namespace declaration applies to unprefixed
> elements.[2]  It does not apply to unprefixed attributes.[3][4]
> 
> All this seems quite clear from the specification (which is over
> twelve years old and hasn't seemed to cause major confusion for
> most of that time).  Apparently, the wording "the interpretation 
> of unprefixed attributes is determined by the element on which 
> they appear" (which was added to the June 2006 Second Edition of 
> the spec) is the cause of some current confusion.  In retrospect,
> I can see how adding that wording was perhaps not the best choice.
> If it helps, ignore it, as it wasn't in the original version.
> 
> What that wording was trying to say is that the semantics in an
> application sense--not in an XML parsing sense--of an unprefixed
> attribute may be determined by the element on which it occurs.
> For example, name="foo" attribute on an HTML <a> element means
> something different from name="foo" on an HTML <param> element.
> The unprefixed "name" attribute on the <a> element is semantically
> not (necessarily) related to the unprefixed "name" attribute on
> the <param> element.  Given that the namespace specification doesn't
> discuss application semantics anywhere else, perhaps it would have 
> been better not to have added this phrase.  In any case, nothing 
> in this statement has anything to do with namespace interpretation. 

  Completely agree with this answer :-)
Thanks for drafting this out !

> [signature]
> 
> [1] "...a namespace declaration applies to all element and attribute 
> names within its scope whose prefix matches that specified in the
> declaration."
> 
> [2] "A default namespace declaration applies to all unprefixed element 
> names within its scope."
> 
> [3] "Default namespace declarations do not apply directly to attribute names."
> 
> [4] "The namespace name for an unprefixed attribute name always has no value."

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

Received on Saturday, 6 August 2011 15:08:42 UTC