Message model objects: groups

A group is a list of elements that defines how those elements appear in a message. Groups define the composition and content validation of a complex type.

In XML Schema, groups can be ordered (sequence), unordered (all), or selective (choice).

In DFDL Schema, groups can be ordered (sequence), unordered (sequence but with DFDL property dfdl:sequenceKind="unordered"), or selective (choice).

In message definition files in message sets, groups can be ordered (sequence), unordered (all), or selective (choice). For more information, see Message Sets: XML Schema extensions in message sets.

What are groups for?

Groups can be used for any of the following purposes:

  • To define the entire element content of a complex type.

    A complex type can refer to a global group that completely defines its content. (If it does not, the content of the complex type is defined by an anonymous local group, which is hidden within the Message Definition Editor.)

  • To represent a common substructure within more than one type.

    Two or more complex types can refer to the same global group, if they both contain the same subset of elements.

  • To change the composition midway through a complex type.

    You might have a complex type that is a sequence of three members, but the second member is a choice of two elements. To model this circumstance, a group with composition set to choice can be inserted as the second member of the sequence.

Contents of a group

Groups can contain complex elements, simple elements, wildcard elements, and groups.

By combining these components, the structure of any message can be modeled. Wildcard elements can be included to enable the presence of unmodeled elements, thus making the message model robust and flexible.

Global and local groups

Groups can be global or local.

A global group can be used in more than one place in the message model. It represents a structure that is present in more than one place in the message model. A global group must be given a unique name by which it can be referenced by a group reference.

A local group is defined in one position within one group, and is not available for reuse elsewhere in the message model. Local groups do not have a name, and are displayed by using the composition of the group.