Re: Bug in embedded schema in test 2.3.a

Hi,

Some more details...

Short version: the schema element in this test case is missing an
elementFormDefault="qualified" attribute.

Explanation:

The schema is defined as:

<xsd:schema targetNamespace="http://commerce.example.com/payment">
    <xsd:simpleType name="ccnumber">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="\d{14,18}" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:element name="payment">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="number" type="my:ccnumber"
minOccurs="0" />
                <xsd:element name="expiry" type="xsd:gYearMonth"
minOccurs="0" />
            </xsd:sequence>
            <xsd:attribute name="method" type="xsd:string" />
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

In the absence of an elementFormDefault attribute, its default value
"unqualified", is applied (see
http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#declare-schema ).

As a consequence, "inner" elements are assumed to be in no namespace and
instance documents should be of the form:

<my:payment xmlns:my="http://commerce.example.com/payment">
 <number>123456789012356</number>
 <expiry>1998-12</expiry>
</my:payment>

rather than (as expected):

<payment xmlns="http://commerce.example.com/payment">
 <number>123456789012356</number>
 <expiry>1998-12</expiry>
</payment>

which is invalid.

The fix is to add the missing attribute:

<xsd:schema targetNamespace="http://commerce.example.com/payment"
elementFormDefault="qualified">
...

Hope this helps,

Eric

Received on Thursday, 8 August 2013 20:02:54 UTC