RE: Two consecutive derivations by restriction

Hello Rainer,
 
There is nothing in Structures that prevents you from performing
consecutive derivations.  The problem with your example is that the
Street element is required in the ListType (and in FirmaType), so you
have to include it in the content model for OperatorType.  Otherwise,
instances of OperatorType would never also be valid for FirmaType, which
is a requirement when deriving by restriction.  You can either change
OperatorType to include Street, or make Street optional in both ListType
and FirmaType.  
 
Hope that helps!
Priscilla
-----------------------------------------------------
Priscilla Walmsley             priscilla@walmsley.com
Author, Definitive XML Schema     (Prentice Hall PTR)
----------------------------------------------------- 

-----Original Message-----
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]
On Behalf Of Rainer Becker
Sent: Friday, July 12, 2002 4:56 AM
To: 'xmlschema-dev@w3.org'
Subject: Two consecutive derivations by restriction


Hallo,
 
I hope, that this has not been answered before, but I couldnīt find a
hint in this list.
My questions are:
 
First question:
 
Is it possible, to perform two or more consecutive derivations by
restriction?
 
Given the following schema:
 
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   
   <xsd:element name="Liste">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element name="Firma" type="FirmaType" />
            <xsd:element name="Operator" type="OperatorType" />     
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>
   
   <xsd:complexType name="ListType">
      <xsd:sequence>
         <xsd:element name="Name" type="xsd:string" />
         <xsd:element name="Comment" type="xsd:string" minOccurs="0"
maxOccurs="3"/>
         <xsd:element name="Street" type="xsd:string" />
      </xsd:sequence>
   </xsd:complexType>
   
   <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>    
   
</xsd:schema>
 
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.
 
If my assumption is correct I would also be interested to know, why this
is forbidden?
 
Second question: I tried to find some kind of confirmation in the
"Structures" for this problem.
 
If one was able to give me a pointer in Structures, I would be very
thankful.
 
Regards
 
Rainer Becker
 

Received on Monday, 15 July 2002 14:10:10 UTC