Groups a set of attribute declarations so that they can be incorporated as a group for complex type definitions.
<attributeGroup
id = ID
name = NCName
ref = QName
{any attributes with non-schema Namespace…}>
Content: (annotation?), ((attribute | attributeGroup)*, anyAttribute?))
</attributeGroup>
id value must be of type ID and be unique within the document containing this element.
Optional.
<attributeGroup> element or <complexType> element. The name must be a no-colon-name (NCName) as defined in the XML Namespaces specification. The name and ref attributes cannot both be present. The <name> attribute can only be present if the attribute group is a child of the <schema> element.
Optional.
<attributeGroup> element or <complexType> element.
The name and ref attributes cannot both be present. The ref attribute can only be present if the attribute group is not a child of the <schema> element.
This value must be a qualified name (QName).
Optional.
| Number of occurrences | Unlimited |
| Parent elements | attributeGroup, complexType, schema, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent) |
| Contents | annotation, attribute, attributeGroup, anyAttribute |
An attribute group can be defined only as a child of the <schema> element. In this case, the name attribute must be present and contain the <attribute>, <attributeGroup>, or <anyAttribute> elements that make up the attribute group.
An attribute group can be included in an <attributeGroup> or <complexType>, in which case, the ref attribute must be present and the <attributeGroup> element must be empty. See the following example.
The <attributeGroup> elements can contain other <attributeGroup> elements.
The following example shows an attribute group defined ("myAttributeGroup") and used in a complex type ("myElementType").
<xs:attributeGroup name="myAttributeGroup">
<xs:attribute name="someattribute1" type="xs:integer"/>
<xs:attribute name="someattribute2" type="xs:string"/>
</xs:attributeGroup>
<xs:complexType name="myElementType">
<xs:attributeGroup ref="myAttributeGroup"/>
</xs:complexType>
The following example shows two attribute groups defined ("myAttributeGroupA" and "myAttributeGroupB") with one containing the other.
<xs:attributeGroup name="myAttributeGroupA">
<xs:attribute name="someattribute10" type="xs:integer"/>
<xs:attribute name="someattribute11" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="myAttributeGroupB">
<xs:attribute name="someattribute20" type="xs:date"/>
<xs:attributeGroup ref="myAttributeGroupA"/>
</xs:attributeGroup>
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-attributeGroup.

W3C Namespaces in XML Recommendation
| This HTML Help has been published using the chm2web software. |