W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2004

Re:deriving restriction types

From: gayathri veerarajan <gaytri_v@yahoo.co.in>
Date: Sat, 10 Apr 2004 12:13:51 +0100 (BST)
Message-ID: <20040410111351.53116.qmail@web8201.mail.in.yahoo.com>
To: Xan Gregg <Xan.Gregg@jmp.com>
Cc: xmlschema-dev@w3.org


Yahoo! India Matrimony: Find your partner online.
Thanks for ur reply Sir.I orginally did not mean this way.

<xsd:complexType name="WineGrape">
 <xsd:choice minOccurs="0" maxOccurs="unbounded" > <!--it is just xsd:choice -->
  <xsd:element ref="WineGrape"  /> 
  <xsd:element ref="CabernetFrancGrape"  /> 
  <xsd:element ref="CabernetSauvignonGrape" /> 
  <xsd:element ref="ChardonnayGrape"  /> 
  <xsd:element ref="CheninBlancGrape"  /> 
  <xsd:element ref="ZinfandelGrape"  /> 
  <xsd:element ref="GamayGrape"  /> 

it is just <xsd:choice> ,since I would be referencing this type in  two different cases as follows

<xsd:complexType name="Wine">
	<xsd:element name="madeFromGrape" type="WineGrape" minOccurs="0" maxOccurs="unbounded"/>

<xsd:complexType name="Zinfandel">
	<xsd:element name="madeFromGrape" type="WineGrape" minOccurs="0" maxOccurs="1"/>

since maxOccurs  is set to "1" for the element "madeFromGrape" as above 
When we consider the following Wine type the maxOccurs I prefer to have <xsd:choice> as a generalised one.

Now I would like to derive a restricted Wine as folows

<xsd:complexType name="StEmilion">
   <xsd:restriction base="Wine">
	<xsd:element name="madeFromGrape" type="CabernetFrancGrape" minOccurs="0" maxOccurs="unbounded"/>

and cabernetFrancGrape is derived from WineGrape. my requirement is that the element madeFromGrape should have the subelement CabernetFrancGrape and also have any other elements. 

<xsd:complexType name="CabernetFrancGrape">
- <xsd:complexContent>
-   <xsd:restriction base="vin:WineGrape">
-     <xsd:sequence>
        <xsd:element ref="CabernetFrancGrape" minOccurs="1" maxOccurs="unbounded" /> 
        <xsd:element ref="CabernetSauvignonGrape" minOccurs="0" maxOccurs="unbounded" /> 
        <xsd:element ref="ChardonnayGrape" minOccurs="0" maxOccurs="unbounded" /> 
        <xsd:element ref="CheninBlancGrape" minOccurs="0" maxOccurs="unbounded" /> 
        <xsd:element ref="ZinfandelGrape" minOccurs="0" maxOccurs="unbounded" /> 
        <xsd:element ref="GamayGrape" minOccurs="0" maxOccurs="unbounded" /> 

but sequence doesn't seem to work. is there any other way of doing this.
I cannot do as u have suggested,since type WineGrape is a general one and each time I have to pose different restriction.
could u suggest me any other way of doing this Sir.

thank u,
Received on Saturday, 10 April 2004 07:14:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:04 UTC