You have two problems, at least:
1) The error
Attribute 'MaxOccurs' cannot appear in element 'element'."
Explains it all. It's maxOccurs
. Case matters.
2) You are defining your enginesize
element as a simple type (type="integer"
) while at the same time defining it as a complex type (nested <complexType>
). You can't have them both.
If you want an enginesize
element that has an attribute and also accepts an integer as simple content, you have to define it as having simple content, and use an extension to add the attribute.
What I believe you want to achieve is something like this:
<xsd:element name="enginesize" maxOccurs="2">
<xsd:complexType mixed="true">
<xsd:simpleContent>
<xsd:extension base="xsd:integer">
<xsd:attribute name="unit" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="CC"/>
<xsd:enumeration value="CL"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>