Question: How do i make xjc/Jaxb generate the propper javaclasses for several schemas containing duplicate elementdefinitions in the same namespace?
Information: I have three .xsd schemas: A,B and C. All have the same targetnamespace. They are all 3 shemas that has been given to me, and i am not, in any way possible, allowed to change them in any way.
They A has some elements that is also found in B or C (but A has a lot of self declared elements as well) Example: This is the same "code" for A and C:
<xs:simpleType name="y_ym_ymdDatoType">
<xs:union memberTypes="arcgYearType arcgYearMonthType arcDateType"/>
</xs:simpleType>
<xs:simpleType name="arcgYearType">
<xs:restriction base="xs:gYear">
<xs:minInclusive value="1700"/>
<xs:maxInclusive value="2100"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="arcgYearMonthType">
<xs:restriction base="xs:gYearMonth">
<xs:minInclusive value="1700-01"/>
<xs:maxInclusive value="2100-12"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="arcDateType">
<xs:restriction base="xs:date">
<xs:minInclusive value="1700-01-01"/>
<xs:maxInclusive value="2100-12-31"/>
</xs:restriction>
</xs:simpleType>
When using xjc to compile them into javaclasses, i get the following exception:
[ERROR] 'y_ym_ymdDatoType' is already defined
line 297 of file:../c.xsd
[ERROR] (related to above error) the first definition appears here
line 309 of file:../a.xsd
and the same happens to the other elements: arcgYearType, arcgYearMonthType and arcDateType.
I have read about a binding file that maybe could solve this problem, but i am not sure on how to do it so examples will be highly preferred.