Restriction with substitution, can I do this???

Is this valid, I basically have a type which contains a sequence of 
itself.   Then I define two restrictions,  Blue and Green, and then comes 
my question.... called MyQuestionBase, can I substitute the unbounded 
"item" element with just two subclasses Blue and Green.  This seems like 
substitution groups, but they are not global elements, they are global 
complex types that I am substituting for "item" in the restriction.   This 
validates OK, but I don't really trust if it is valid?????  Please help
joey coyle

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" attributeFormDefault="unqualified">

         <xs:complexType name="Base">
                 <xs:sequence>
                         <xs:element name="item" type="Base" 
maxOccurs="unbounded"/>
                 </xs:sequence>
         </xs:complexType>


         <xs:complexType name="BlueBase">
                 <xs:complexContent>
                         <xs:restriction base="Base">
                                 <xs:sequence>
                                         <xs:element name="item" 
type="Base" maxOccurs="unbounded"/>
                                 </xs:sequence>
                         </xs:restriction>
                 </xs:complexContent>
         </xs:complexType>


         <xs:complexType name="GreenBase">
                 <xs:complexContent>
                         <xs:restriction base="Base">
                                 <xs:sequence>
                                         <xs:element name="item" 
type="Base" maxOccurs="unbounded"/>
                                 </xs:sequence>
                         </xs:restriction>
                 </xs:complexContent>
         </xs:complexType>



         <xs:complexType name="MyQuestionBase">
                 <xs:complexContent>
                         <xs:restriction base="Base">
                                 <xs:sequence>
                                         <xs:element name="blue" 
type="BlueBase"/>
                                         <xs:element name="green" 
type="GreenBase"/>
                                 </xs:sequence>
                         </xs:restriction>
                 </xs:complexContent>
         </xs:complexType>


</xs:schema>

Received on Tuesday, 12 March 2002 04:25:13 UTC