We are using an industry standard XML schema and we are trying to use
Castor to generate XML to Java objects. We are getting the following error :
SchemaException:An element declaration with the given name
TransactionSetPurposeCode already exists
Part of our schema looks like:
<xs:element name="BeginningSegmentForTradingPartnerProfile">
<xs:annotation>
<xs:documentation>BTP Segment</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="TransactionSetPurposeCode"/>
<xs:element ref="ReferenceIdentification"/>
<xs:element ref="TransactionTypeCode"/>
<xs:element ref="TransactionSetPurposeCode"
minOccurs="0"/>
> <xs:element
ref="ReferenceIdentification"
> minOccurs="0"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> I guess the Castor program is complaing about element
> TransactionSetPurposeCode being referred twice. But is this an
invalid
> schema or this is a Castor limitation? This schema is also an
industry
> standard and not a home grown one. We need to find out about it as
soon as
> possible, because if this is a Castor problem, we need to think about
a
> different technology and we have a tight deadline... 
>
> Really appreciate your help.
this is a current limitation of the Castor SOM.
XML Schema allows to have the same element declarations in a <sequence>.
If you had a <choice> or an <all>, the schema would have been invalid