AttributeGroup - Element des XML-Schemas
❮ Vollständige XML-Schema-Referenz
Definition und Verwendung
Das Element attributeGroup wird verwendet, um einen Satz von Attributdeklarationen zu gruppieren, sodass sie als Gruppe in komplexe Typdefinitionen integriert werden können.
Elementinformationen
- Übergeordnete Elemente: attributeGroup, complexType, Schema, Restriction (sowohl simpleContent als auch complexContent), Erweiterung (sowohl simpleContent als auch complexContent)
Syntax
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(Das ?-Zeichen gibt an, dass das Element null oder einmal vorkommen kann, und das *-Zeichen gibt an, dass das Element null oder mehrmals innerhalb des attributeGroup-Elements vorkommen kann.)
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 |
Beispiel 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>
Das obige Beispiel definiert eine Attributgruppe namens „personattr“, die in einem komplexen Typ namens „person“ verwendet wird.
❮ Vollständige XML-Schema-Referenz