Hello,
i am trying to unmarshall an xml file using castor mapping to my jaxb2
generated sources. the xml is deformed in some way that i cannot use jaxb2
unmarshalling directly. I saw a project proposal about supporting jaxb2
types but i assume it is quite new and could not see any source code about
that.Actually the only problem in my case seems to be the enumeration types
of jaxb2.
i tried using custom handlers for this type but as far as i can understand
from the examples,the value from the xml needs to be casted to the original
object first and then processed for formatting and such.This is the class
that i cannot map to
public enum MyEnum {
@XmlEnumValue("2")
TWO("2");
private final String value;
MyEnum(String v) {
value = v;
}
public String value() {
return value;
}
public MyEnum setValue(String x) {
return this.fromValue(x);
}
public static MyEnum fromValue(String v) {
for (MyEnum c: MyEnum.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
i tried to create a class with just a string value and casting the xml value
to this but i could not convert it back with the custom handler and add it
to the parent object that is going to be unmarshalled. Am i missing
something here? Any pointers would be helpful,
Thanks is advance,