W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2002

Re: Inheritance of restriction facets?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Sun, 11 Aug 2002 17:38:06 +0100
Message-ID: <158308031816.20020811173806@jenitennison.com>
To: xmlschema-dev@w3.org, "zze-MARCHEGAY Michael stagiaire FTRD/DTL/LAN" <michael.marchegay@rd.francetelecom.com>
CC: "Eddie Robertsson" <erobertsson@allette.com.au>

Hi Michael,

> I'm sorry to have submitted an invalid schema. But would it have
> been invalid if I had written the following schema instead?
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   <xsd:simpleType name="foo">
>       <xsd:restriction base="xsd:string">
>         <xsd:enumeration value="A"/>
>         <xsd:enumeration value="AA"/>
>         <xsd:enumeration value="AAA"/>
>       </xsd:restriction>
>   </xsd:simpleType>
>   <xsd:element name="bar">
>     <xsd:simpleType>
>       <xsd:restriction base="foo">
>         <xsd:minLength value="2"/>
>       </xsd:restriction>
>     </xsd:simpleType>
>   </xsd:element>
> </xsd:schema>
> XML Spy 4.3 validates this schema but sqc doesn't. It complains that
> <xsd:minLength value="2"/> is not compatible with the enumeration
> facets defined by the ancestors foo, however I can't find out the
> clause that justifies that in the Recommandation.

There's no constraint (that I can see) that states that the length
specified in a derived type has to be such that all the enumerations
in the base type are still legal. Indeed, it would be a very weird
derivation by restriction if it didn't allow you to restrict the
values that you were allowed to have.

The above schema looks perfectly fine to me; the bar element can only
have the values 'AA' and 'AAA'.



Jeni Tennison
Received on Sunday, 11 August 2002 12:38:08 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:04 UTC