Occurrence indicators are used within element content models to specify how many times an element may appear at a given location. The indicators available to schema developers are listed below:
Occurrence Indicator | Meaning | XML Authority Qlicker |
---|---|---|
none | The element must appear once and only once. | Neither optional nor repeatable. |
? | The element (or group of elements) may appear zero or one times. The element is optional, but is only allowed to appear once. | Optional but not repeatable. |
+ | The element (or group of elements) must appear one or more times. The element is required to appear at least once, but multiple consecutive occurrences may be present. | Repeatable but not optional. |
* | The element (or group of elements) may appear zero or more times. The element can appear as many times consecutively as needed, or even zero times. | Repeatable and optional. |
{} | The element (or group of elements) must appear within the specified range. (For XSDL and SOX only.) | Set occurrence range. |
In combination with sequence indicators, these choices make it possible to describe complex structures. For example, a memo might allow multiple entries in its To: and From: fields, multiple (or zero) entries in its Cc: field, a single entry for the subject, required content for the body, and an optional set of initials at the bottom for the typist. A MEMO element might therefore have the following content model:
(To+, From+, Cc*, Subject, Body, Typist?)
This declaration requires the MEMO element to contain, in sequence, one or more To elements, one or more From elements, zero or more Cc elements, a single Subject element, a single Body element, and zero or one Typist elements.
Copyright 2000 Extensibility, Inc.
Suite 250, 200 Franklin Street, Chapel Hill, North Carolina 27516