Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Re: optional, but at least one required >Thread Next - Re: optional, but at least one required Re: optional, but at least one requiredTo: "Virginia Wiswell" <vwiswell@-------.---> Date: 10/11/2007 10:32:00 AM To be pedantic, removing the second <xsd:element ref="a"/> prevents the Unique Particle Attribution violation for _a_. We then need to work around this change by adding minOccurs="0" to element b so we allow what we want. :-), Pete. ----- Original Message ----- From: "Virginia Wiswell" <vwiswell@v...> To: "Pete Cordell" <petexmldev@t...>; "Virginia Wiswell" <vwiswell@v...> Cc: <xmlschema-dev@w...> Sent: Thursday, October 11, 2007 2:35 AM Subject: Re: optional, but at least one required > > So the minOccurs="0" on element b prevents the Unique Particle Attribution > violation for b? > > This is perfect, Pete. Thanks so much for helping me out. > > On Wed, 10 Oct 2007 19:22:51 +0100 > "Pete Cordell" <petexmldev@t...> wrote: >> >> Hi Virginia, >> >> Your schema should indeed yield a Unique Particle Attribution violation. >> The reason is that when a parser reads element a, it is not immediately >> obvious whether it corresponds to the first definition of a or the >> second. >> >> You can get around this by changing your schema to: >> >> <xsd:element name="parent"> >> <xsd:complexType> >> <xsd:choice> >> <xsd:sequence> >> <xsd:element ref="a"/> >> <xsd:element ref="b" minOccurs="0"/> >> </xsd:sequence> >> <xsd:element ref="b"/> >> </xsd:choice> >> </xsd:complexType> >> </xsd:element> >> -- ============================================= Pete Cordell Codalogic for XML Schema to C++ data binding visit http://www.codalogic.com/lmx/ ============================================= From kstaniraji@y... Thu Oct 11 08:57:12 2007 Received: from aji.w3.org ([133.27.228.225]) | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
