Re: [xml-dev] attributes with same name and different prefix

From
Elliotte Rusty Harold <>
To
"Christopher R. Maden" <>,
Date
2002-04-28T14:07:21Z
ID
<p04330105b8f1aba2456a@[192.168.254.4]>
Thread
Re: [xml-dev] attributes with same name and different prefix
At 2:40 PM -0700 4/27/02, Christopher R. Maden wrote:


>><foo src="bar" xmlns:src="some-uri" />
>
>This is perfectly legal, but note that what you have is an element with one
>attribute and one namespace declaration - *not* two attributes.
>


No, there are two attributes here. One has the name src and one has 
the name xmlns:src. The XML 1.0 specification is quite clear about 
this. Namespaces in XML does not change this. Indeed it states, "A 
namespace is declared using a family of reserved attributes. Such an 
attribute's name must either be xmlns or have xmlns: as a prefix. 
These attributes, like any other XML attributes, may be provided 
directly or by default." Even the infoset calls these "namespace 
attributes" and specifies that each one is represented as an 
attribute information item. Obviously, these are attributes.

Some applications of XML choose to separate out namespace attributes 
from other attributes. XSLT is most notable here. Others always 
include them. DOM is most notable here. And still others make it a 
user-specifiable option. SAX is most notable here. But there's really 
no grounds for the claim that xmlns:src is not an attribute.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold |  | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+