Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Redefine question [Thread Next] deriving restriction types -Sorry for the previous message-please read this msgTo: 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. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
