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

On Wed, Jun 12, 2002 at 11:54:09AM -0400, Morris Matsa wrote:
> > I believe it does explicitly disallow ACMs,
> > and would appreciate some clarification from those who are better versed
> > on the subject.
> 
> My understanding of the rec:  Ambiguous content models are allowed.  What
> is required is that by looking at the next tag's name I must already be
> able to unambiguously attribute it to a given unique particle in the
> schema.  This disallows most ambiguous content models but allows some of
> them.  The rec includes a constraint for this [1], and a non-normative
> explanation. [2]
> 
> [1] http://www.w3.org/TR/xmlschema-1/#cos-nonambig
> [2] http://www.w3.org/TR/xmlschema-1/#non-ambig

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?

Can anyone suggest a reasonable way to achieve the desired constraint?

The alternatives I have thought of are:

1) Choose two of the three of startDate, endDate, duration.  I am not
sure if it is possible to retain ordering in this circumstance.

2) Allow each of startDate, endDate, and duration to occur zero or one
times.  Allows ordering to be retained, but opens possibility of having
zero, one, or three of the items, rather than the required two.

Ian.

  <complexType name="periodType">
    <choice>
      <sequence minOccurs="0">
        <element ref="startDate"/>
        <element ref="endDate"/>
      </sequence>
      <sequence minOccurs="0">
        <element ref="startDate"/>
        <element ref="duration"/>
      </sequence>
      <sequence minOccurs="0">
        <element ref="duration"/>
        <element ref="endDate"/>
      </sequence>
      <element ref="instant" minOccurs="0"/>
      <element ref="forever" minOccurs="0"/>
    </choice>
  </complexType>

-- 
Ian Stokes-Rees, Client Services      DecisionSoft Ltd.
Telephone: +44-1865-203192            http://www.decisionsoft.com

Received on Wednesday, 12 June 2002 12:38:39 UTC