Element grupy atrybutów schematu XML
❮ Pełne odniesienie do schematu XML
Definicja i użycie
Element attributeGroup służy do grupowania zestawu deklaracji atrybutów, tak aby można je było włączyć jako grupę do definicji typów złożonych.
Informacje o elemencie
- Elementy nadrzędne: atrybutGroup, complexType, schemat, ograniczenie (zarówno simpleContent, jak i complexContent), rozszerzenie (zarówno simpleContent, jak i complexContent)
Składnia
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(Znak ? deklaruje, że element może wystąpić zero lub jeden raz, a znak * deklaruje, że element może wystąpić zero lub więcej razy wewnątrz elementu 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 |
Przykład 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>
W powyższym przykładzie zdefiniowano grupę atrybutów o nazwie „personattr”, która jest używana w typie złożonym o nazwie „person”.
❮ Pełne odniesienie do schematu XML