Let me take this opportunity to congratulate JAXB team & contributors
for successful release of JAXB 2.0; Great job.
I was successful in upgrading our system from JAXB 1 to JAXB 2 except a
minor problem. I was able to compile schemas using JAXB 1 and was able
to parse documents successfully. Same schemas are not getting compiled
properly with JAXB2; JAXB2 is complaining about duplicate elements as
indicated below.
Schema definitions with problem:
--------------------------------------------------
Core Schema
<xs:group name="CommonAddressDetailsGroup">
<xs:annotation>
<xs:documentation>This Address Group
is for common items to all Addresses</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="AddressLine"
type="core:AddressLineType" maxOccurs="3"/>
<xs:element name="City"
type="core:CityType"/>
</xs:sequence>
</xs:group>
<xs:group name="InternationalAddressDetailsGroup">
<xs:annotation>
<xs:documentation>This Address Group
is for items specific for International Addresses</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="StateProvince"
type="core:StateProvinceType" minOccurs="0"/>
<xs:element name="PostalCode"
type="core:PostalCodeType" minOccurs="0"/>
<xs:element name="CountryCode"
type="core:CountryCodeType"/>
</xs:sequence>
</xs:group>
-------------------------------------------
FFEL Schema (imports Core Schema)
<xs:group name="FFELDomesticAddressDetailsGroup">
<xs:annotation>
<xs:documentation>This Address Group
is for items specific for US Addresses</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="StateProvinceCode"
type="core:StateProvinceCodeType"/>
<xs:element name="PostalCode"
type="core:PostalCodeType"/>
<xs:element name="CountryCode"
type="core:CountryCodeType" minOccurs="0"/>
</xs:sequence>
</xs:group>
<xs:group name="FFELGeneralAddressGroup">
<xs:annotation>
<xs:documentation>This is a combined
Address Group for a choice between Domestic or
International</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:group
ref="core:CommonAddressDetailsGroup"/>
<xs:choice>
<xs:group
ref="FFEL:FFELDomesticAddressDetailsGroup"/>
<xs:group
ref="core:InternationalAddressDetailsGroup"/>
</xs:choice>
</xs:sequence>
</xs:group>
<xs:complexType name="FFELBaseAddressType">
<xs:sequence>
<xs:group
ref="FFEL:FFELGeneralAddressGroup"/>
</xs:sequence>
</xs:complexType>
FFELBaseAddressType code generation is failing to generate properly and
complains about duplicate "PostalCode" and "CountryCode". System is not
generating other classes that extend FFELBaseAddressType.
When I removed those 2 elements from "InternationalAddressDetailsGroup"
definition everything works fine.
PS: Attached are the JAXB 1 & 2 generated java files.
Any ideas?
Thanks,
Anand