I need to generate java classes for 3rd party schema I received (and unfortunately cannot modify), that looks like that:
...
<xs:element name="ARec">
<xs:complexType>
<xs:sequence>
<xs:element name="ARecTyp" />
<xs:element name="AGrp" />
<xs:element name="AGrpId" />
...
And using maven-jaxb2-plugin, I'm able to do that, but my classes has all them members declared as
@XmlElement(name = "ARecTyp", required = true)
protected Object aRecTyp;
(which, I believe, is correct and default mapping of xs:anyType). But in reality these elements are all texts, and I'd like to have it bound to java.lang.String, not java.lang.Object.
I tried to add
<globalBindings>
<javaType name="java.lang.String" xmlType="xs:anyType"/>
</globalBindings>
but that won't work, as xs:anyType is complexType, not simpleType, so I'm getting exception. Is there any other way of mapping such xs:element without specified type to String instead of Object?