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

Re: Choice

From: Jeni Tennison <jeni@jenitennison.com>
Date: Fri, 8 Mar 2002 14:54:43 +0000
Message-ID: <43277512221.20020308145443@jenitennison.com>
To: Piccand Régis <regis.piccand@imtf.ch>
CC: "'Beyer,Nathan'" <NBEYER@cerner.com>, "Schema Dev XML (E-mail)" <xmlschema-dev@w3.org>
Hi Piccand,

> I'm trying to have an unordered list of elements that can be
> "mandatory OR optional" AND repeatable (i.e. elements are unordered
> and "MinOccurs" and "MaxOccurs" must be specified for each element).
> Using "All", maxoccurs is bound to 1 (optional but not repeatable).
> Using "sequence", elements are ordered (optional and repeatable).
> Using "choice", elements are optional (repeatable but not
> mandatory).
> Is there a possibility to achieve what I'm trying to do ?

Basically, no, not with XML Schema. Your options are to:

  - create a content model that expresses all possible combinations of
    the elements (usually impractical)
  - use a choice, and then use another schema language, such as
    Schematron, to express the constraints about elements that must be
  - create a schema for a canonical form of the markup language in
    which the elements must occur in a specific order, then use a
    transformation to get instance documents into that canonical
    ordering prior to validation



Jeni Tennison
Received on Friday, 8 March 2002 09:54:46 UTC

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