group

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - XML Schemas

group

The XML-Data Reduced (XDR) schema element that organizes content into a group to specify a sequence.

<group
  maxOccurs="{1 | *}" 
  minOccurs="{0 | 1}" 
  order="{one | seq | many}" >

Attributes

maxOccurs
The maximum number of times the group can occur. The following values can be assigned to this attribute.

1 Occurs a maximum of one time.
* An unlimited number of occurrences is allowed.

minOccurs
The minimum number of times the group can occur. The following values can be assigned to this attribute.

0 Not required; the group is optional.
1 Must occur at least once.

order
A constraint on the sequence of elements (and other contained groups) within this group. The following values can be assigned to this attribute.

one Permits only one instance of each element contained in the group. This corresponds to the "|" (vertical bar) symbol in the document type definition (DTD).

Allowed as part of ElementType and group.

seq Requires the elements in the group to appear in the specified sequence. This is the default value.

Allowed as part of ElementType and group.

many Permits the elements in the group to appear (or not appear) in any order.

Allowed as part of ElementType and group.

The seq setting is required to specify valid sequences. For example, it can be used to specify when a particular sequence, such as x1,y1 or x2,y2, is valid but no other possible combinations are valid. The seq value serves the same role as parentheses in a DTD.

Element Information

Number of occurrences Unlimited.
Parent elements ElementType
Child elements element, description

Element Properties

TAG Explanation
order='one' Permits only one of a set of elements.
* order='seq' Indicates that the elements must appear in the listed sequence. This is similar to the default for a list of elements, however this is necessary in order to group sequences, as in the example where either x1,y1 or x2,y2 is legal but where no other combinations are. Serves the same role as parentheses in a DTD.
order='many' The elements may appear (or not appear) in any order.
minOccurs='0' or '1' maxOccurs='1' or '*' Allows precise definition of cardinality. '*' on maxOccurs means unlimited.

Remarks

The order attribute takes the same values as the order attribute of the ElementType element.

The minOccurs and maxOccurs attributes have the default value 1. A group with neither attribute must appear once and only once in a content model.

Examples

The following example demonstrates the one setting.

<ElementType name="z" order="one">
<element type="x">
<element type="y">
</ElementType>

The following represents a legal instance of the schema.

<z>
  <x/> 
  <y></y> 
</z>

The following example demonstrates the seq setting.

<ElementType name="x" order="one">
  <group order="seq">
    <element type="x1">
    <element type="y1">
  </group>
  <group order="seq">
    <element type="x2">
    <element type="y2">
  </group>
</ElementType>

The following two examples represent legal instances of this schema.

<x>
  <x1/> 
  <y1/>
</x>

and:

<x>
  <x2/>
  <y2/>
</x>

The following example demonstrates the many setting.

<ElementType name="x" content="eltOnly" order="many">
  <element type="q">
  <element type="r">
</ElementType>

The following five examples represent all legal instances for this schema.

<x> </x>
<x> <q> </x>
<x> <r> </x>
<x> <q> <r> </x>
<x> <r> <q> </x>

See Also

XDR Schema Elements | XDR Schema Data Types Reference