xsdata.codegen.handlers.attribute_mismatch module

class xsdata.codegen.handlers.attribute_mismatch.AttributeMismatchHandler[source]

Bases: xsdata.codegen.mixins.HandlerInterface

Classes can not container attributes derived from xs:enumeration and any other schema element. Although very rare it can happen in silly cases when the author of the schema is trying to restrict the enum type with another xs:simpleType.

Apart from visibility about the origin of the enumeration values it doesn’t serve any other purpose. In this case simply drop non enum attributes

<xsd:simpleType name="ApplicableSizesType">
<xsd:restriction>
  <xsd:simpleType>
    <xsd:list itemType="SizeType"/>
  </xsd:simpleType>
  <xsd:enumeration value="small medium large"/>
  <xsd:enumeration value="2 4 6 8 10 12 14 16 18"/>
</xsd:restriction>
</xsd:simpleType>
classmethod process(target)[source]

Drop non enum attributes from enum classes.

Parameters

target (Class) –