Элемент attributeGroup схемы XML
❮ Полный справочник по XML-схеме
Определение и использование
Элемент attributeGroup используется для группировки набора объявлений атрибутов, чтобы их можно было включить как группу в определения сложного типа.
Информация об элементе
- Родительские элементы: attributeGroup, complexType, схема, ограничение (как simpleContent, так и complexContent), расширение (как simpleContent, так и complexContent)
Синтаксис
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(Знак ? указывает, что элемент может встречаться ноль или один раз, а знак * объявляет, что элемент может встречаться ноль или более раз внутри элемента 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 |
Пример 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>
В приведенном выше примере определяется группа атрибутов с именем «personattr», которая используется в сложном типе с именем «person».
❮ Полный справочник по XML-схеме