Groups a set of element declarations so that they can be incorporated as a group into complex type definitions.
<group name= NCName id = ID maxOccurs = (nonNegativeInteger | unbounded) : 1 minOccurs = nonNegativeInteger : 1 name = NCName ref = QName {any attributes with non-schema Namespace}…> Content: (annotation?, (all | choice | sequence)) </group>
This attribute is used only when the schema element is the parent of this group element. In this case, the group is a model group to be used by complexType, choice, and sequence elements.
Optional.
Optional.
Limited when the group is not a child of the schema element.
Optional.
Limited when the group is not a child of the schema element.
Optional.
Required if the containing element is the schema element.
Optional.
If the ref attribute is present, id, minOccurs, and maxOccurs may be present. Ref and name are mutually exclusive.
To declare a group using an existing group definition, use the ref attribute to specify the existing group definition.
<xs:group ref="globalGroup"/>
Optional.
Number of occurrences | Unlimited |
Parent elements | schema, choice, sequence, complexType, restriction (complexContent), extension (complexContent) |
Contents | annotation, all, choice, sequence |
Any one of the following elements can be a child of the group element.
choice | Permits one and only one of the elements contained in the group. |
sequence | Requires the elements in the group to appear in the specified sequence. |
all | Allows the elements in the group to appear (or not appear) in any order in the containing element. |
The minOccurs and maxOccurs attributes have the default value 1. A group with neither attribute must appear once and only once in the containing element.
The following example defines a group containing a sequence of three elements and uses the group element in a complex type definition.
<xs:element name="thing1" type="xs:string"/> <xs:element name="thing2" type="xs:string"/> <xs:element name="thing3" type="xs:string"/> <xs:attribute name="myAttribute" type="xs:decimal"/> <xs:group name="myGroupOfThings"> <xs:sequence> <xs:element ref="thing1"/> <xs:element ref="thing2"/> <xs:element ref="thing3"/> </xs:sequence> </xs:group> <xs:complexType name="myComplexType"> <xs:group ref="myGroupOfThings"/> <xs:attribute ref="myAttribute"/> </xs:complexType>
XML Schema Reference (XSD) | XML Schema Elements
For more information, see the W3C XML Schema Part 1: Structures Recommendation at http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-group.
W3C Namespaces in XML Recommendation