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

deriving restriction types -Sorry for the previous message-please read this msg

From: gayathri veerarajan <gaytri_v@yahoo.co.in>
Date: Thu, 8 Apr 2004 14:02:43 +0100 (BST)
Message-ID: <20040408130243.45738.qmail@web8206.mail.in.yahoo.com>
To: xmlschema-dev@w3.org
please dont consider my previous message, it was by mistake i sent it.
sorry for the inconvenience.
please reply to this message.


Yahoo! India Matrimony: Find your partner online.

I would like to know whether this is a valid restriction

<xsd:complexType name="WineGrape">
 <xsd:choice>
  <xsd:element ref="WineGrape" minOccurs="0" maxOccurs="unbounded" /> 
  <xsd:element ref="CabernetFrancGrape" minOccurs="0" 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:choice>
</xsd:complexType>

I want to derive a new complex type restricted from wineGrape where I expect the element  CabernetFrancGrape to appear atleast once.

so I tried deriving as follows ,but it gave me an error.

<xsd:complexType name="WineGrape_hasValue_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>
</xsd:complexType>

Is this because of the sequence construct in place of choice.
If I give choice then only the element CabernetFrancGrape would appear each time when this type is referenced(because its minoccurs is 1). Is my assumption correct?

and also I dont think that sequence construct in place of choice is a problem, because the code mentioned below  got validated

<xsd:complexType name="WineGrape_ZinfandelGrape">
- <xsd:complexContent>
- <xsd:restriction base="vin:WineGrape">
- <xsd:sequence>
  <xsd:element ref="ZinfandelGrape" /> 
  </xsd:sequence>
  </xsd:restriction>
  </xsd:complexContent>
  </xsd:complexType>

please suggest how to do this.

regards,
V.gayathri.   
Received on Thursday, 8 April 2004 09:03:17 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:11 UTC