Re: Choice

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
    present
    
  - 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

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

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