define a simpletype at first and use this simpletype to extend the complextype you need<xs:schema ><xs:element name="ELEMENTS"> <xs:complexType> <xs:sequence> <xs:element ref="EL_ONE" /> </xs:sequence> </xs:complexType></xs:element> <xs:simpleType name="ZERO_ONE_Type"> <xs:restriction base="xs:integer"> <xs:minInclusive value="0"/> <xs:maxInclusive value="7"/> </xs:restriction></xs:simpleType><xs:element name="EL_ONE"> <xs:complexType> <xs:simpleContent> <xs:extension base="ZERO_ONE_Type"> <xs:attribute name="id" type="xs:string" /> </xs:extension > </xs:simpleContent> </xs:complexType></xs:element> </xs:schema>hope can help you