I had a field in XSD schema:
<xs:element name="magicField">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:totalDigits value="8"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
In java class was generated a field:
int magicField;
But then, xsd schema has changed to:
<xs:element name="magicField">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="int_code">
<xs:totalDigits value="8"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
</xs:element>
Where "int_code":
<xs:complexType name="int_code">
<xs:simpleContent>
<xs:extension base="xs:positiveInteger">
<xs:attribute name="name"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
And JAXB generates the following code:
MagicField magicField;
and MagicField.java in additional.
But I still need only
int magicField;
in generated code.
Attribute "name" won't be used at all.
I can't change the schema, my way is only binding file (xjb).
How I should create the binding to re-map "int_code" type and get "magicField" as simpleType (int
in code), not complexType (magicField
in code)?
As I understand I also need a custom XmlAdapter, not only binding rule.
Thanks in advance.