[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: your comments on 4.6.1 Namespaces and Attributes




Julian Reschke wrote:


I still have problems with this section (which is now at 4.7.1):

<quote>
4.7.1 Namespaces and Attributes

  There is a frequently misunderstood aspect of the relationship
  between unprefixed attributes and the default XML namespace - the
  natural assumption is that an unprefixed attribute is qualified by
  the default namespace, but this is not true.  Rather, the unprefixed
  attribute belongs to a set of attributes that are defined
  specifically for the element to which it is applied.  Thus, in the
  following:

     <ns1:fox a="xxx" n:b="qqq"/>
     <ns1:bay a="yyy" n:b="rrr"/>
     <ns2:baz a="zzz" n:b="sss"/>

  The meaning of attribute "a" is defined separately for each
  attribute.  By comparison, the prefixed attribute "n:b" is defined
  independently of the element to which it is applied.
</quote>

1) It's true that unprefixed attributes inherit a default namespace. They
are technically in no namespace.

2) It's new to me that being prefixed or not carries *any* hint about
whether the attribute is "defined" (BTW: what is meant by 'defined' in this
context) specifically for an element or not. Can you cite the XML
recommendation or XML Infoset to back this up? Otherwise the text needs at
least to be clarified.


Its not so much the 'definition' of the attribute, but more on the 'context' of the attribute. Non-prefixed attributes are dependant on and live within the context of the element, while prefixed attributes are global attributes, and are not dependant of the context of a particular element. How they are defined really depends on the particular type of schema you are using.

Also, any distinction based on context is usually considered document-specific; SOAP for example prefixes all attributes used within its headers. Once you accept the document format defines the use of prefixed/nonprefixed attributes, it really only becomes an issue for canonicalization (and unfortunately I haven't read the c14n recommendation yet to know their take on the whole thing).

-David Waite