XML Schema attributeGroupElement
Complete XML Schema Reference Manual
Definition and Usage
The attributeGroup element is used to group attribute declarations so that these declarations can be merged into complex types as a group.
Element Information
- Parent element: attributeGroup, complexType, schema, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent)
Syntax
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(The ? sign declares that an element can appear zero or one time inside the attributeGroup element, and the * sign declares that an element can appear zero or more times.)
| Attributes | Description |
|---|---|
| id | Optional. Specifies a unique ID for the element. |
| name | Optional. Specifies the name of the attribute group. The name and ref attributes cannot both appear at the same time. |
| ref | Optional. Specifies a reference to the specified attribute group. The name and ref attributes cannot both appear at the same time. |
| any attributes | Optional. Specifies any other attributes with a non-schema namespace. |
Example 1
<xs:attributeGroup name="personattr">
<xs:attribute name="attr1" type="string"/>
<xs:attribute name="attr2" type="integer"/>
</xs:attributeGroup>
<xs:complexType name="person">
<xs:attributeGroup ref="personattr"/>
</xs:complexType>
<xs:attribute name="attr1" type="string"/>
<xs:attribute name="attr2" type="integer"/>
</xs:attributeGroup>
<xs:complexType name="person">
<xs:attributeGroup ref="personattr"/>
</xs:complexType>
The example above defines an attribute group named "personattr", which is used in the complex type named "person".
Complete XML Schema Reference Manual
Other Extensions