- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 12 Jun 2002 17:47:48 +0100
- To: xmlschema-dev@w3.org, Ian Stokes-Rees <ijs@decisionsoft.com>
- CC: Morris Matsa <mmatsa@us.ibm.com>
Hi Ian, > Perhaps I can better serve the discussion by providing the explicit > example in question (see below). I would say that this is an illegal > ACM as you cannot identify from the single token "startDate" whether > you are in theh first sequence (startDate, endDate) or the second > sequence (startDate, duration). > > Do others believe this type definition is legal or illegal? Illegal, per the Unique Particle Attribution constraint, since given a startDate element you can't tell whether you're in the first or second sequence within the choice. > Can anyone suggest a reasonable way to achieve the desired > constraint? It looks as though the minOccurs="0" can be moved onto the xs:choice rather than being on each of the particles (allowing elements of the periodType to be empty). Then you can do: <xs:complexType name="periodType"> <xs:choice minOccurs="0"> <xs:sequence> <xs:element ref="startDate" /> <xs:choice> <xs:element ref="endDate" /> <xs:element ref="duration" /> </xs:choice> </xs:sequence> <xs:sequence> <xs:element ref="duration" /> <xs:element ref="endDate" /> </xs:sequence> <xs:element ref="instant" /> <xs:element ref="forever" /> </xs:choice> </xs:complexType> In other words, if you find a startDate, you know that it can only be followed by either an endDate or a duration. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Wednesday, 12 June 2002 12:47:50 UTC