Namespace qualification

Hi,

I have namespace qualification question.
Suppose, we have the following schema:

<schema xmlns="http://www.w3.org/2001/XMLSchema"
    targetNamespace="aaa"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
>
<element name="a">
    <complexType>
        <simpleContent>
            <restriction base="string">
                <attribute name="q"/>    <!-- Attribute must be unqualified,
since attributeFormDefault equals to 'unqualified' -->
                <attribute name="w" form="qualified" />    <!-- Here we
state that the attribute must be qualified -->
            </restriction>
        </simpleContent>
    </complexType>
</element>
</schema>

Thus, we have string-content element "a" with two attributes. Attribute 'q'
must be unqualified and attribute 'w' must be qualified. Is the following
XML instance valid ?

<a xmlns="aaa" q="1" w="2"/>

I believe, this is ambiguos case. According to the spec
(http://www.w3.org/TR/REC-xml-names/#defaulting) default namespaces do not
apply directly to attributes. However, the attribute's namespace is
considered to be the same as element's namespace if no namespace prefix is
specified for the attribute. Am I right ? So, if there is an error than
where is it ? In namespace qualification of attribute 'q' or 'w' ?

Thank you,
Gregory

Received on Wednesday, 23 January 2002 13:41:36 UTC