×
XML Schema 教程XML Schemas 简介为什么使用 Schema?如何使用 XML SchemaSchema 元素XSD 简易元素Schema 属性Schema 限定 / FacetsSchema 复合元素Schema 复合空元素Schema 复合类型 - 仅含元素Schema 复合元素 - 仅含文本Schema 复合类型 - 混合内容Schema 指示器Schema any 元素anyAttribute 元素Schema 元素替换XML Schema 实例Schema 字符串数据类型Schema 日期/时间类型Schema 数值数据类型Schema 杂项数据类型XML 编辑器XML Schema 总结XML Schema 参考手册

XML Schema attributeGroup 元素


XML Schema 参考手册XML Schema 参考手册


定义和用法

attributeGroup 元素用于对属性声明进行组合,这样这些声明就能够以组合的形式合并到复杂类型中。

元素信息

  • 父元素: attributeGroup, complexType, schema, restriction (both simpleContent and complexContent), extension (both simpleContent and complexContent)

语法

<attributeGroup
id=ID
name=NCName
ref=QName
any attributes
>

(annotation?),((attribute|attributeGroup)*,anyAttribute?))

</attributeGroup>

(? 符号声明在 attributeGroup 元素中,元素可出现零次或一次,* 符号声明元素可出现零次或多次。)

属性 描述
id 可选。规定该元素的唯一的 ID。
name 可选。规定属性组的名称。name 和 ref 属性不能同时出现。
ref 可选。规定对指定的属性组的引用。name 和 ref 属性不能同时出现。
any attributes 可选。规定带有 non-schema 命名空间的任何其他属性。

实例 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 Schema 参考手册XML Schema 参考手册


分类导航

关注微信下载离线手册

bootwiki移动版 bootwiki
(群号:472910771)