users@jaxb.java.net

Jaxb2 enum problem

From: Rochak Gupta <rochak005_at_gmail.com>
Date: Tue, 18 May 2010 14:29:18 +0530

HI,



While updgrading JAXB1.x to JAXB2.1.10 migration , there is a problem lies
in the enumeration . I am pasting the snapshot of xsd which is catching
problem



<xs:simpleType name="ProfileToggleType">

            <xs:restriction base="xs:string">

                  <xs:enumeration value="SubscriptionProfile" />

                  <xs:enumeration value="Sync_Test" />

            </xs:restriction>

      </xs:simpleType>



When we do unmarshal a request



com.att.osd.bbnms.bbcats.xml.synctest.schema.SyncTestRequest *req* =

            (com.att.osd.bbnms.bbcats.xml.synctest.schema.SyncTestRequest)
unmarshaller

               .unmarshal(request);



When we get the respective value from the unmarshalled *req *object and do
subsequent processing as given below



*if* (*SYNC_TEST*.equals(profile))

      {

          profile = ProfileConstants.*SYNCTEST_PROFILE*;

      }



The comparison is failing because we expect as per to xsd “Sync_Test” however
we are getting “SYNC_TEST” . In JAXB1 we were getting as defined in xsd i.e.
“Sync_Test”


So is there any way through some external binding we can stop jaxb
marshaller/unmarshaller to convert everything to bold and have exactly as
there in xsd .

Thanks and regards,
Rochak Gupta