Cardinality: optional, required, and repeating elements
The number of occurrences of an element can be controlled using the properties Min Occurs and Max Occurs. Using these properties, an element can be defined as mandatory, optional or repeating.
A mandatory, or required, element has Min Occurs>= 1. A mandatory element must occur at least once in the message.
An optional element has Min Occurs = 0. An optional element can be omitted from the message.
A repeating element has Max Occurs> 1 to indicate a bounded number of repeats, or Max Occurs=unbounded (sometimes displayed as -1), to indicate an unlimited number of repeats. A repeating element occurs more than once in the message, and all the occurrences must appear together without any other elements between them.
If a complex type or a group contains two, or more, members that refer to the same element, the second reference is a duplicate. This is different from a repeating element, because the two references are typically separated by other members of the type or group. In the message, the second occurrence typically does not appear immediately after the first occurrence.
The number of occurrences of an attribute can be controlled by setting it to required, optional or prohibited.
A required attribute is similar to a mandatory element - it must occur in the message.
An optional attribute is similar to an optional element - it can be omitted from the message.
A prohibited attribute must not appear in the message.
An attribute is not allowed to repeat, and duplicate attribute references are not allowed within an attribute group.