Re:deriving restriction types

 


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"  /> 
 </xsd:choice>
</xsd:complexType>

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

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


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

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:complexContent>
   <xsd:restriction base="Wine">
     <xsd:sequence>
	<xsd:element name="madeFromGrape" type="CabernetFrancGrape" minOccurs="0" maxOccurs="unbounded"/>
     </xsd:sequence>
   </xsd:restriction>
  </xsd:
  </xsd:complexType>  

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" /> 
     </xsd:sequence>
  </xsd:restriction>
 </xsd:complexContent>

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,
V.Gayathri.

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