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

Re: Two consecutive derivations by restriction

From: Jeni Tennison <jeni@jenitennison.com>
Date: Mon, 15 Jul 2002 19:11:06 +0100
Message-ID: <6800809703.20020715191106@jenitennison.com>
To: Rainer Becker <r.becker@Nitro-Software.com>
CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>

Hi Rainer,

> Is it possible, to perform two or more consecutive derivations by
> restriction?

Yes, it is.

> Given the following schema:
>    <xsd:complexType name="FirmaType">
>       <xsd:complexContent>
>         <xsd:restriction base="ListType">
>            <xsd:sequence>
>               <xsd:element name="Name" type="xsd:string" />
>               <xsd:element name="Comment" type="xsd:string" minOccurs="0"
> maxOccurs="2" />
>               <xsd:element name="Street" type="xsd:string" />
>            </xsd:sequence>   
>         </xsd:restriction>
>       </xsd:complexContent>
>    </xsd:complexType>
>    <xsd:complexType name="OperatorType">
>       <xsd:complexContent>
>          <xsd:restriction base="FirmaType">
>             <xsd:sequence>
>                <xsd:element name="Name" type="xsd:string" />
>             </xsd:sequence>
>          </xsd:restriction>
>       </xsd:complexContent>
>    </xsd:complexType>    
> Although I am not 100% sure I donīt think it is, because this schema
> produces an "invalid particle derivation by restriction". I can not
> find any other mistake in it.

There is another mistake in it. You're deriving the OperatorType from
the FirmaType by restriction, which means that a valid element of the
type OperatorType must (by definition) be a valid element of the type
FirmaType. The FirmaType has an obligatory Name, an optional Comment
and an obligatory Street. In the OperatorType, on the other hand,
there's no Street. That means that an element of the type OperatorType
mustn't have a Street element, but if it doesn't have a Street element
it can't be a valid FirmaType. So the derivation must be wrong.

To fix it, either the OperatorType must contain a Street or the Street
in the FirmaType must be optional (have a minOccurs of 0).

> Second question: I tried to find some kind of confirmation in the
> "Structures" for this problem.
The section that gives the constraints on valid derivations by
restriction is 3.4.6, specifically Schema Component Constraint:
Derivation Valid (Restriction, Complex) at



Jeni Tennison
Received on Monday, 15 July 2002 14:11:09 UTC

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