Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » JiBX Unmarshalling - No enum Const error
JiBX Unmarshalling - No enum Const error [message #534261] Tue, 18 May 2010 14:06
Bill  is currently offline Bill
Messages: 5
Registered: March 2010
Junior Member
Im confused. I have 2 different enumerations in my xsd. For some reason when unmarshalling 1 of them it doesn't work. And i get the valueOf error with No enum const class.

java.lang.IllegalArgumentException: No enum const class com.soa.empiorg.HierarchyRequest$Hierarchy Type.immediate
at java.lang.Enum.valueOf(Enum.java:207)
at com.soa.empiorg.HierarchyRequest$Hierarchy Type.valueOf(HierarchyRequest.java:1)

code:
   public static enum HierarchyType { 
        EXTENDED("extended"), IMMEDIATE("immediate"); 
        private final String value; 

        private HierarchyType(String value) { 
            this.value = value; 
        } 

        public String toString() { 
            return value; 
        } 

        public static HierarchyType convert(String value) { 
            for (HierarchyType inst : values()) { 
                if (inst.toString().equals(value)) { 
                    return inst; 
                } 
            } 
            return null; 
        } 
    } 




xsd:
<xs:attribute name="hierarchyType"> 
    <xs:simpleType> 
        <xs:restriction base="xs:string"> 
           <xs:enumeration value="extended"/> 
           <xs:enumeration value="immediate"/> 
        </xs:restriction> 
    </xs:simpleType> 
</xs:attribute> 


Input XML:
<?xml version="1.0" encoding="iso-8859-1"?> 
<EMPIORG:HierarchyRequest xmlns:EMPIORG="http://x/EMPIOrg" relTypeNumber="1" hierarchyType="immediate"> 
        <EMPIORG:Header sending="Cesar"/> 
        <EMPIORG:HierarchySearchCriteria> 
                <EMPIORG:enterpriseId>27053</EMPIORG:enterpriseId> 
        </EMPIORG:HierarchySearchCriteria> 
</EMPIORG:HierarchyRequest> 

[Updated on: Tue, 18 May 2010 14:06]

Report message to a moderator

Previous Topic:'Updating JSP Index' has encountered a problem.
Next Topic:Updating a struts.xml page
Goto Forum:
  


Current Time: Thu Oct 23 05:22:37 GMT 2014

Powered by FUDForum. Page generated in 0.17442 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software