<xsd:restriction> 元素 (complexContent)

定义对 complexContent 定义的约束。

<restriction
  base = QName
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (group | all | choice | sequence)?, ((attribute |
attributeGroup)*, anyAttribute?))
</restriction>

特性

  • base
    在该架构(或由指定的命名空间指示的其他架构)中定义的 complexType 元素的名称。 包含 restriction 元素的元素是从基值所指定的类型派生的。

    基值必须是限定名 (QName)。

    必选。

  • id
    该元素的 ID。 id 值必须属于类型 ID 并且在包含该元素的文档中是唯一的。

    可选。

元素信息

出现次数

一次

父元素

complexContent

内容

groupallchoicesequenceattributeattributeGroupanyAttribute

示例

以下示例说明使用 restriction 的复杂类型定义。 复杂类型,即 USAddress,是从常规地址复杂类型派生而来的,其 country 元素固定为 US

另请参见

参考

XML 架构 (XSD) 参考
XML 架构元素