[xsde-users] C1061: Blocks nested too deeply

Holzer, Tony (AS) anthony.holzer at ngc.com
Fri Jun 27 13:18:32 EDT 2014


I am using xsde 3.2 with a schema delivered that I cannot modify. The schema has an enumeration defined to have close to 300 values. A short snippet of the schema is:
            <xs:simpleType name="MessageTypeEnum">
                        <xs:restriction base="xs:string">
                                    <xs:enumeration value="Value 1"/>
                                    <xs:enumeration value="Value 2"/>
                                    <xs:enumeration value="Value 3"/>
                                    <xs:enumeration value="Value 4"/>

I generate code using the following command:
xsde cxx-hybrid --no-stl --no-exceptions --no-iostream --no-long-long --generate-parser --generate-serializer --generate-aggregate


XSD/e generates a huge if/else-if block to compare each string value and assign an enumeration. The code generated is:
    if (strcmp (s, "Value 1") == 0)
      v = MessageTypeEnum::Value1;
    else if (strcmp (s, "Value 2") == 0)
      v = ::NIOP::MessageTypeEnum::AIR_SAMPLE_CAPABILITY;
    else if (strcmp (s, "Value 3") == 0)

Since the enumeration is so large, it quickly hits the Visual Studio compiler limit of 128 nesting levels. I have searched the xsde-users archives and have not seen this issue raised.
Any help is appreciated.

Tony Holzer
Northrop Grumman Aerospace Systems



More information about the xsde-users mailing list