![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - xsd:simpletype or [Thread Next] Re: xs:choice and xs:sequence questionTo: <d_a_carver@-----.--->, <xmlschema-dev@--.---> Date: 1/12/2006 9:10:00 AM (In addition to George's comment), what you have here is a Unique Particle Attribution Constraint (UPAC) violation. I think it's Appendix H of Schema part one that explains this better, but basically when encountering 'DescriptionMessage' it's not immediately obvious to a validator whether it belongs to the first sequence or the second. A simple fix (if it doesn't violate your idea of aesthetics too much!) would be to move 'ApplicationReasonCode' to the top of the second sequence. Then it becomes unambiguous about which leg of the choice is being parsed. HTH, Pete. ----- Original Message ----- From: "David Carver" <d_a_carver@y...> To: <xmlschema-dev@w...> Sent: Wednesday, January 11, 2006 3:37 PM Subject: xs:choice and xs:sequence question > > 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 > -- ============================================= Pete Cordell Tech-Know-Ware Ltd for XML to C++ data binding visit http://www.tech-know-ware.com/lmx (or http://www.xml2cpp.com) ============================================= From ht@i... Thu Jan 12 09:51:47 2006 Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
