Question: How to get xjc / Jaxb to generate javaclass for propper for several schemes containing duplicate definitions of elements in one namespace?
Information: I have three .xsd schemes: A, B and C. They all have the same namespace. These are all 3 shemas that were provided to me, and in no way can I change them in any way.
They have some elements that are also in B or C (but A also has many self-declared elements) 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 in 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 thing happens with other elements: arcgYearType, arcgYearMonthType and arcDateType.
I read about a binding file that might possibly solve this problem, but I'm not sure how to do this, so examples will be very preferred.
java xsd jaxb xjc
Sofus Albertsen
source share