Title: javaclassmapping=element or type

Hi there, this is an extract from the castorbuilder.properties. Please can someone explain to me why javaclassmapping element and type get handled differently for simpleTypes when creating source.

# Java class mapping of <xsd:element>'s and <xsd:complexType>'s
#
#org.exolab.castor.builder.javaclassmapping=element
org.exolab.castor.builder.javaclassmapping=type


    When I used javaclassmapping=element, the following schema extract worked as follows : I could generate a class Header which has a getSuite() method that returns an int. The source generator created a descriptor that validated the data (ie. suite could either be 40 or 39). Now that I am using javaclassmapping=type the source generator creates a descriptor type that only  validates the data as an int and does not check that the data is also either 39 or 40.

        <xs:element name="header">
                <xs:complexType>
                        <xs:sequence>
                                <xs:element name="suite" type="SuiteType"/>
                        </xs:sequence>
                </xs:complexType>
        </xs:element>
        <xs:simpleType name="SuiteType">
                <xs:restriction base="SuiteSimpleType"/>
        </xs:simpleType>
        <xs:simpleType name="SuiteSimpleType">
                <xs:restriction base="xs:int">
                        <xs:enumeration value="39"/>
                        <xs:enumeration value="40"/>
                </xs:restriction>
        </xs:simpleType>

I am very confused by this change as I thought that they only handled the element and type differently, not also the simpleType. Please could someone give me a hand. I am lost.

Thanks
Jamie



Reply via email to