trouble with content models

Andy Davidson <[email protected]>
Newsgroups gmane.text.xml.schema.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.