Re: Applying namespaces to unprefixed attribute names

On Nov 1, 2005, at 11:17 PM, Sean M. Burke wrote:

>
> I am confused about a particular aspect of XML namespaces as  
> defined in the "Namespaces in XML" document and its errata.   
> Namely: I can't find anywhere in the spec (or errata) that  
> explicitly explains how to treat unqualified attributes -- i.e.,  
> explaining how they get their namespace.

That's because unprefixed attribute names can never be in an XML  
namespace.  Element and attribute names are different.  Element names  
can be in a namespace in two different ways; by being prefixed, or  
unprefixed with a default namespace in effect.  An attribute can be  
in a namespace only when prefixed.

That is to say, in

<e1 xmlns="a:c" xmlns:x="d:e"><e2 a1="1"/><x:e3 a2="2"/><e4 x:a3="3"/ 
 ></e1>

only a3 is in a namespace, neither a1 nor a2 are in any namespace. -Tim

Received on Wednesday, 2 November 2005 18:37:36 UTC