Repeated choice with some but not all mandatory

From W3C Wiki
Jump to: navigation, search

Repeated choice with some but not all mandatory (a co-constraint use case)

Allow the specification of groups of elements in which the order of elements does not matter, certain of the elements are mandatory, others optional, and the maximum number of occurrences of a particular element is not limited to 1.

source: Regis Piccand [1]


Other use cases: Co-constraint Use Cases

Description

   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).

Analysis

(Add your analysis here; see your name in pixels!)

MSM

This is a classic formulation of the use case for removing the constraint that says elements in an all group must have maxOccurs = 1. It can be done with co-constraints, but the stronger all group seems preferable.

Possible solutions

Relax NG

Schematron

Check clause

SchemaPath

Conditional Type