W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2006

rules for restrictions need to be reworked

From: Temp - Nixon, Tristan <temptn@carnegielearning.com>
Date: Tue, 12 Sep 2006 19:41:56 +0000
Message-Id: <9609466E-F5EA-4E22-A7CA-8BC25E355C96@carnegielearning.com>
To: <www-xml-schema-comments@w3.org>
I suggest that restrictions of types should imply changes only to  
those elements specified, not to all elements in the base type.



For example:



<xs:complexType name=”addressType”>

   <sequence>

     <xs:element name=”street” type=”xs:string”>

     <xs:element name=”city” type=”xs:string”>

   </sequence>

</xs:complexType>



Currently needs to be restricted like so:



<xs:complexType name=”simpleAddressType”>

   <xs:complexContent>

     <xs:restriction base=”addressType”>

       <sequence>

         <xs:element name=”street” type=”xs:string”>

         <xs:element name=”city” type=”xs:string”>

       </sequence>

     </xs:restriction>

   </xs:complexContent>

</xs:complexType>



I would propose that this should be accomplished by the following:



<xs:complexType name=”simpleAddressType”>

   <xs:complexContent>

     <xs:restriction base=”addressType”>

       <sequence>

         <xs:element name=”street” type=”xs:string”>

       </sequence>

     </xs:restriction>

   </xs:complexContent>

</xs:complexType>



Where the only elements altered from the base type definition are  
those mentioned within the restriction tags.

In order to remove elements from a definition, this could be  
accomplished as follows:



<xs:complexType name=”simpleAddressType”>

   <xs:complexContent>

     <xs:restriction base=”addressType”>

       <sequence>

         <xs:element name=”city” type=”xs:string” maxOccurs=”0”>

       </sequence>

     </xs:restriction>

   </xs:complexContent>

</xs:complexType>
Received on Thursday, 21 September 2006 23:54:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 23 October 2007 06:13:40 GMT