Hello,
I am using JAXB to generate code for some schemas created by a different group in my project, but I get an error that I kind of understand but don't know exactly how to resolve.
This is a pared-down version of the schema holding only the offending pieces:
MainSchema.xsd
---
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns_a="DATASET_A"
xmlns:ns_b="DATASET_B"
xmlns:ns_c="DATASET_C"
xmlns:ns_d="DATASET_D"
xmlns:ns_e="DATASET_E"
xmlns:ns_f="DATASET_F">
<xs:include schemaLocation="BASIC_TYPES.XSD" />
<!-- -->
<xs:import namespace="DATASET_A" schemaLocation="DATASET_A.xsd"/>
<xs:import namespace="DATASET_B" schemaLocation="DATASET_B.xsd"/>
<xs:import namespace="DATASET_C" schemaLocation="DATASET_C.xsd"/>
<xs:import namespace="DATASET_D" schemaLocation="DATASET_D.xsd"/>
<xs:import namespace="DATASET_E" schemaLocation="DATASET_E.xsd"/>
<xs:import namespace="DATASET_F" schemaLocation="DATASET_F.xsd"/>
<xs:complexType name="ReturnGetDataStatusType">
<xs:sequence>
<xs:element name="DATA_LIST">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:choice>
<xs:group ref="ns_a:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_b:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_c:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_d:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_e:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_f:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<!-- -->
<xs:complexType name="FileDataType">
<xs:sequence>
<xs:element name="DATA_LIST">
<xs:complexType>
<xs:choice>
<xs:group ref="ns_a:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_b:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_c:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_d:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_e:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
<xs:group ref="ns_f:ReturnGetDataItemType" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="RETURN_GET_DATA" type="ReturnGetDataStatusType"/>
<xs:element name="FILE_DATA" type="FileDataType"/>
</xs:schema>
---
When I try to compile this schema and their underlying schemas, I get this error repeated for each "group" attribute of the FileDataType:
C:\dir\temp\fake_DataStore>xjc -d output -p com.company.stuff *.xsd *.XSD | more
parsing a schema...
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 49 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 50 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 50 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 51 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 51 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 52 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 52 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 53 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] Property "ReturnGetDataItemType" is already defined. Use <jaxb:property> to resolve this conflict.
line 53 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
[ERROR] The following location is relevant to the above error
line 54 of file:/C:/dir/temp/fake_DataStore/MainSchema.xsd
Failed to parse a schema.
---
It clearly has a problem with using the same group references in two different complexTypes, but I don't know how to use jaxb:property to resolve it.
Do I rename this ReturnGetDataItemType differently in the FileDataType complexType? If so, how?
Thank you for reading. Please let me know if you have any questions.
Edited by: jaylogan on Mar 18, 2010 6:49 PM