In restrictions, you repeat the content model with the restrictions in place. Here we have several optional parts:
<xs:complexType name="Product"> <xs:sequence> <xs:element name="number" type="xs:string"/> <xs:element name="name" type="xs:string"/> <xs:element name="size" type="my:Size" minOccurs="0"/> <xs:element name="color" type="my:Colors" minOccurs="0"/> </xs:sequence> </xs:complexType>
Then we can restrict content to be products with a size element:
<!-- Forced to have a size --> <xs:complexType name="ProductWithSize"> <xs:complexContent> <xs:restriction base="my:Product"> <xs:sequence> <xs:element name="number" type="xs:string"/> <xs:element name="name" type="xs:string"/> <xs:element name="size" type="my:Size"/> <xs:element name="color" type="my:Colors" minOccurs="0"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType>