Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: =?iso-8859-1?q?gayathri=20veerarajan?= <gaytri_v@-----.--.-->
To: xmlschema-dev@--.---
Date: 4/8/2004 3:03:00 PM
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.   


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent