elemento XML Schema attributeGroup
Definição e Uso
attributeGroup elemento é usado para declarar atributos são combinados, de modo que estas instruções podem ser combinados de modo a formar no tipo complexo.
elemento de Informação
- Elemento pai: attributeGroup, complexType, esquema de restrição (ambos simpleContent e complexContent), extensão (ambos simpleContent e complexContent)
gramática
<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
id=ID
name=NCName
ref=QName
any attributes
>
(annotation?),((attribute|attributeGroup)*,anyAttribute?))
</attributeGroup>
(? Entrar declara attributeGroup elemento, o elemento pode ocorrer zero ou uma vez, * sinal declara que o elemento pode ocorrer zero ou mais vezes.)
属性 | 描述 |
---|---|
id | 可选。规定该元素的唯一的 ID。 |
name | 可选。规定属性组的名称。name 和 ref 属性不能同时出现。 |
ref | 可选。规定对指定的属性组的引用。name 和 ref 属性不能同时出现。 |
any attributes | 可选。规定带有 non-schema 命名空间的任何其他属性。 |
exemplo 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>
<xs:attribute name="attr1" type="string"/>
<xs:attribute name="attr2" type="integer"/>
</xs:attributeGroup>
<xs:complexType name="person">
<xs:attributeGroup ref="personattr"/>
</xs:complexType>
O exemplo acima define um grupo propriedade denominada "personattr" usando tipo complexo chamado "pessoa" no.
XML completo Referência de esquema