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

RE: Restricting child elements in a schema

From: <dilpa.mehta@guycarp.com>
Date: Thu, 2 Dec 2004 10:30:07 -0500
To: xmlschema-dev@w3.org
Cc: mike@saxonica.com
Message-ID: <OF3552B29D.F57AA66F-ON88256F5D.00791266-85256F5E.00558D27@guycarp.com>
Let me describe my problem little more in detail.
We are using acord schema as our base. We have no control over changing 
the acord schema.
We defined our own schema and we imported acord schema so that we could 
resuse acord elements.
We used <xs:restrction> for some complex types and used <xs:extension> for 
others. 
We used <xs:extension> for complex types coz we have following 
requirements
        1) Use some elements within the complex type as it is
        2) Redefine some elements to make them required as they were not 
required in acord schema 
        3) Add more elements to the extended complex type
The problem we are facing is while doing step # 3.
Here is an snippet,

Parent Acord schema 
<xs:complexType name="ContractType">
                <xs:sequence>
                        <xs:element ref="ContractName" minOccurs="0"/>
                        <xs:element ref="ContractType" minOccurs="0"/>
                        <xs:element ref="BrokerReference" minOccurs="0"/> 
(Optional)
                </xs:sequence>
</xs:complexType>

Our schema

<xs:import namespace="
http://www.ACORD.org/standards/Jv-Ins-Reinsurance/2004-1" schemaLocation="
Jv-Ins-Reinsurance-2004-1.xsd"/>
<xs:complexType name="GCContractType">
                <xs:complexContent>
                        <xs:extension base="acord:ContractType">
                                <xs:sequence>
                                        <xs:element ref="
acord:BrokerReference" substitutionGroup="acord:BrokerReference"/> (Change 
the element  defined in parent as required and use all the other elements 
as it is and add a new element 'GCContractVersion')
                                        <xs:element ref="GCContractVersion
"/>
                                </xs:sequence>
                        </xs:extension>
                </xs:complexContent>
</xs:complexType>

Above, worked with xmlspy 2004 but with xmlspy 2005 we get an error saying 
substitutionGroup cannot be uused with xs:element as it is local.I read 
the docs and i beleive that substitutionGroup can be used only directly 
under <xs:schema>.
Is there an alernate way of handling this so that  all 3 requirements are 
met?


Thanks
Dilpa
Received on Thursday, 2 December 2004 15:55:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:48 GMT