W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: Ambiguous content models -- allowed or disallowed by XSDL?

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 12 Jun 2002 17:47:48 +0100
Message-ID: <302080105203.20020612174748@jenitennison.com>
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:element ref="startDate" />
        <xs:element ref="endDate" />
        <xs:element ref="duration" />
      <xs:element ref="duration" />
      <xs:element ref="endDate" />
    <xs:element ref="instant" />
    <xs:element ref="forever" />

In other words, if you find a startDate, you know that it can only be
followed by either an endDate or a duration.



Jeni Tennison
Received on Wednesday, 12 June 2002 12:47:50 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC