<xsd:restriction> 元素 (simpleType)

定义对 simpleType 定义的约束。

<restriction
  base = QName
  id = ID
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (simpleType?, (minExclusive | minInclusive |
maxExclusive | maxInclusive | totalDigits |fractionDigits | length |
minLength | maxLength | enumeration | whiteSpace | pattern)*))
</restriction>

特性

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

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

    必选。

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

    可选。

元素信息

出现次数

一次

父元素

simpleType

内容

annotation、fractionDigits、enumeration、length、maxExclusive、maxInclusive、maxLength、minExclusive、minInclusive、minLength、pattern、simpleType、totalDigits、whiteSpace

示例

以下示例说明使用限制的简单类型定义。 (简单类型是从 nonNegativeInteger 派生的并且其 maxInclusive 值设置为 100。)

示例

以下示例说明一个简单类型定义,该类型定义是从 integer 内置类型派生的并且具有 integer 的所有方面(无限制)。

示例

以下示例演示一个简单类型定义,该类型定义是从 string 派生的并且是枚举类型。 值集被限制为指定的值。

另请参见

参考

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