XML Schema attributeGroup Element
Definition and Usage
The attributeGroup element is used to combine attribute declarations so that these declarations can be merged into complex types as a group.
Element Information
Occurrence | Unrestricted |
Parent Element | attributeGroup, complexType, schema, restriction (simpleContent), extension (simpleContent), restriction (complexContent), extension (complexContent) |
Content | annotation, attribute, attributeGroup, anyAttribute |
Syntax
<attributeGroup id=ID name=NCName ref=QName any attributes > (annotation?),((attribute|attributeGroup)*,anyAttribute?)) </attributeGroup>
(? Symbol is declared in the attributeGroup element, the element can appear zero or one time, * symbol declares the element can appear zero or more times.)
Attributes | Description |
---|---|
id | Optional. Defines the unique ID of the element. |
name | Optional. Defines the name of the attribute group. The name and ref attributes cannot appear together. |
ref | Optional. Defines references to the specified attribute group. The name and ref attributes cannot appear together. |
any attributes | Optional. Defines any other attributes with non-schema namespace. |
Sample
<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>
Ang halimbawa sa itaas ay naglalarawan ng isang pangkat ng atributo na may pangalan na "personattr", na ginamit sa kompleksong uri na may pangalan na "person".