Elemento del gruppo di attributi dello schema XML
❮ Riferimento completo allo schema XML
Definizione e utilizzo
L'elemento attributeGroup viene utilizzato per raggruppare una serie di dichiarazioni di attributo in modo che possano essere incorporate come gruppo in definizioni di tipi complessi.
Informazioni sull'elemento
- Elementi principali: attributeGroup, complexType, schema, restrizione (sia simpleContent che complexContent), extension (sia simpleContent che complexContent)
Sintassi
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(Il segno ? dichiara che l'elemento può verificarsi zero o una volta e il segno * dichiara che l'elemento può verificarsi zero o più volte all'interno dell'elemento attributeGroup)
Attribute | Description |
---|---|
id | Optional. Specifies a unique ID for the element |
name | Optional. Specifies the name of the attribute group. Name and ref attributes cannot both be present |
ref | Optional. Specifies a reference to a named attribute group. Name and ref attributes cannot both be present |
any attributes | Optional. Specifies any other attributes with non-schema namespace |
Esempio 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>
L'esempio sopra definisce un gruppo di attributi denominato "personattr" che viene utilizzato in un tipo complesso denominato "person".
❮ Riferimento completo allo schema XML