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