RE: Choice

Hi Jeni,

-----Original Message-----
From: Jeni Tennison [mailto:jeni@jenitennison.com]
Sent: vendredi, 8. mars 2002 15:55
To: Piccand Régis
Cc: 'Beyer,Nathan'; Schema Dev XML (E-mail)
Subject: 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)

--> I aggree
    
  - use a choice, and then use another schema language, such as
    Schematron, to express the constraints about elements that must be
    present

--> hummm ... as far as I know, Schematron is not a w3c recommendation - How
will it evolve/be supported in the future - will the W3C schema evolve in
the direction of Schematron and extend their schema spec to cover Schematron
features ?
    
  - 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

--> I aggree - allthough this process it not complex, I have the feeling
that I'm losing the benefits of using Schemas to validate instance
documents. In other words, I cannot validate an instance document using a
validator and a schema ; I need to "pre-process" my instance document - this
is not what I want. However, your proposal of transforming the instance
document is probably the cleanest at the moment.

Thanks for your proposals

Régis


Cheers,

Jeni

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

Received on Friday, 8 March 2002 10:21:44 UTC