XML technologies / XML Schema / XML Schema element reference / xs:group (reference)

(Excerpt from “XML Schema” by Eric van der Vlist)

Reference to a global element-group declaration or local definition; local definitions cannot be referenced.

<xs:group
    id = xs:ID
    maxOccurs = ( xs:nonNegativeInteger | "unbounded" ) : "1"
    minOccurs = xs:nonNegativeInteger : "1"
    ref = xs:QName
    {beliebige Attribute mit einem Nicht-Schema-Namensraum}
    >
    Content: (xs:annotation?)
</xs:group>

May occur within: xs:choice (outside a group), xs:choice (within a group), xs:complexType (local definition), xs:complexType (global definition), xs:extension (complex content), xs:restriction (complex content), xs:sequence (within a group), xs:sequence (outside a group)

Description

In a local context, xs:group references an element group, logically replacing the reference with the group’s content.

While a group is being redefined through xs:redefine, a self-reference to that group means to include its original content at that point.

Restrictions

Groups cannot be recursive: a group cannot reference itself directly or indirectly within its own definition.

Example

<xs:element name="author">
    <xs:complexType>
        <xs:sequence>
            <xs:group ref="name"/>
            <xs:element ref="born"/>
            <xs:element ref="dead" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute ref="id"/>
    </xs:complexType>
</xs:element>

Attributes

id
Element ID according to W3C XML Schema.

maxOccurs
Maximum group occurrence count.

minOccurs
Minimum group occurrence count.

ref
Qualified name of the group to include.

   

 

 

 

back to top