trouble with content models

Hi

its been a while since I worked with XML Schema. I am not sure I am posting to the correct group. I want to define a content model (a | b | (a &b))

Any idea how I can do this?

I have tried various version of the following I keep getting the following validation error from Eclipse on my POSTransactionLineItemDiscount type

cos-nonambig: discountAmount and discountAmount (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.

<group name="POSTransactionLineItemDiscountByAmount" id="POSTransactionLineItemDiscountByAmount">
  <sequence>
     <element name="discountAmount" type="decimal" minOccurs="0"/>
     <element name="discountAmountReasonCode" type="string" minOccurs="0"/>
  </sequence>
</group>

<group name="POSTransactionLineItemDiscountByPercent">
  <sequence>
 	<element name="discountPercentage" type="decimal" minOccurs="0"/>
        <element name="discountPercentageReasonCode" type="string" minOccurs="0"/>
  </sequence>
</group>

<group name="POSTransactionLineItemDiscountByAmountAndPercent">
  <sequence>
  	<element name="discountAmount" type="decimal" minOccurs="0"/>
        <element name="discountAmountReasonCode" type="string" minOccurs="0"/>
 	<element name="discountPercentage" type="decimal" minOccurs="0"/>
        <element name="discountPercentageReasonCode" type="string" minOccurs="0"/>
  </sequence>
</group>

<complexType name="POSTransactionLineItemDiscount">
  <sequence>
       	<choice>
    		<group ref="pos:POSTransactionLineItemDiscountByAmountAndPercent" />
       		<group ref="pos:POSTransactionLineItemDiscountByAmount" />
       		<group ref="pos:POSTransactionLineItemDiscountByPercent" />
       	</choice>
 </sequence>
</complexType>

I guess I could define a complex base type, and have three extensions to cover the 3 possible content valid content models. How ever this would require me to rework some legacy java applications

thanks

Andy

Received on Wednesday, 15 December 2010 08:56:17 UTC