How should the following in XML namespace specification be interpreted?
A default namespace declaration applies to all unprefixed element names within its scope. Default namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear.
My intuitive understanding is that unprefixed attributes should be interpreted as belonging to the namespace of the element they belong to. However, the following example seems to prove this false:
Schema:
<xs:schema xmlns:myns="http://test.com/xsd/foo" elementFormDefault="qualified"
targetNamespace="http://test.com/xsd/foo" version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="Id" type="xs:string" />
<xs:element name="Foo">
<xs:complexType>
<xs:attribute ref="myns:Id" />
</xs:complexType>
</xs:element>
</xs:schema>
Example that passes validation:
<a:Foo xmlns:a="http://test.com/xsd/foo" a:Id="123" />
Example that fails validation:
<Foo xmlns="http://test.com/xsd/foo" Id="123" />
What gives?