I am trying to generate java classes from a XSD with a XJB. I am running maven plugin maven-jaxb2-plugin in 0.13.1 version. I want to replace an element type by an other type.
Here is an extract of my xsd file:
<xs:complexType name="TestType">
<xs:sequence>
<xs:element name="field1" type="xs:date" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Test2Type">
<xs:sequence>
<xs:element name="field2" type="xs:string" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
If I want to change field1
from xs:date
to something else I have NO error.
Here is an extract from my xjb for this modification:
<bindings node="./xs:complexType[@name='TestType']/xs:sequence/xs:element">
<property>
<baseType>
<javaType name="com.test.WTKTest" parseMethod="com.test.WTKTest.parse" printMethod="com.test.WTKTest.print"/>
</baseType>
</property>
</bindings>
Now if I replace
<xs:element name="field1" type="xs:date" minOccurs="1" maxOccurs="1"/>
by
<xs:element name="field1" type="TestType2" minOccurs="1" maxOccurs="1"/>
and I change my parse
and print
method accordingly, I obtain this error:
compiler was unable to honor this javaType customization. It is attached to a wrong place, or its inconsistent with other bindings.
I have done some tests and I can change the type of an element iif the initial type is a type from xs
namespace else it failed!
Thanks for your help!