Extending complexType with simpleContent always prduces a property of type string

Extending complexType with simpleContent always return type of string. If you change the code to derive from a simpleType you should get the correct simple type value.

E.g. If you set the type of element MyDerivedType to a complexType MyBaseType you will get a proeprty type string in the generated code:

<xs:element name="MyDerivedType" type="MyBaseType" />

<xs:complexType name="MyBaseType">
    <xs:simpleContent>
        <xs:extension base="xs:boolean" />
    </xs:simpleContent>
</xs:complexType>

But if you change this to be a simpleType, it works as expected with a property of type boolean:

<xs:simpleType name="MyBaseType">
    <xs:restriction base="xs:boolean" />
</xs:simpleType>

This is by design as extending a complexType may require additional properties to be generated in a new class to represent the complexType.

Add Feedback