Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xs:choice and xs:sequence question

From: George Cristian Bina <george@---------.--->
To: d_a_carver@-----.---
Date: 1/12/2006 12:56:00 PM
Hi Dave,

I doubt any processor validates your schema, the obvious error is that 
you use both ref and type attributes on xs:element, see for instance:

 > <xs:element ref="DescriptionMessage" type="Description"
 > minOccurs="1" maxOccurs="unbounded" />

Then, inside the same content model no matter if you use different 
models like choice or sequence the element declaration must be 
consistent, that means you cannot have something like

<xs:choice>
  <xs:sequence>
   <xs:element name="a" type="Type1"/>
  </xs:sequence>
  <xs:sequence>
   <xs:element name="a" type="Type2"/>
  </xs:sequence>
</xs:choice>

If you still have problems please post a full cut down sample schema.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


David Carver wrote:
> 
> I have the following complexType coded:
> 
>   <xs:complexType name="ProcessingOutcomeMessage">
>       <xs:choice>
>           <xs:sequence>
>               <xs:element ref="DescriptionMessage" minOccurs="0" 
> maxOccurs="unbounded" />
>               <xs:element ref="MessageReasonCode" minOccurs="0" />
>           </xs:sequence>
>           <xs:sequence>
>               <xs:element ref="DescriptionMessage" type="Description" 
> minOccurs="1" maxOccurs="unbounded" />
>               <xs:element ref="MessageReasonCode" 
> type="MessageReasonCode" minOccurs="1" />
>               <xs:element ref="ApplicationReasonCode" 
> type="ApplicationReasonCode" minOccurs="1">
>                   <xs:annotation>
>                       <xs:documentation 
> source="http://www.starstandard.org">Contains a software specific 
> application reason code.</xs:documentation>
>                   </xs:annotation>
>               </xs:element>
>           </xs:sequence>
>       </xs:choice>
>   </xs:complexType>
> 
> It validates fine if using Xerces J 2.7.0 or XSV 2.5.  However, 
> Microsoft's XML, XMLSpy">XMLSpy 2006 SP2, and Oxygen complain about 
> DescriptionMessage being defined twice, even though they are in seperate 
> sequence groups.
> 
> What I want to do is require DescriptionMessage, MeassageReasonCode if 
> there is an ApplicationReasonCode, if there isn't an 
> ApplicationReasonCode, then DescriptionMessage and MessageReasonCode are 
> optional.
> 
> Any help would be appreciated.
> 
> Thanks.
> 
> Dave
> 
> 

From george@o... Thu Jan 12 09:01:10 2006
Received: from aji.w3.org ([133.27.228.225])
	by frink.w


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent