XML Schema 参考手册

Elemen XSD

Elemen Pengertian
all Tetapkan bahawa elemen anak boleh muncul dalam urutan mana-mana, dan setiap elemen anak boleh muncul nol kali atau sekali.
annotation Elemen annotation adalah elemen tingkatan pertama, yang menetapkan anotasi schema.
any Membolehkan pencipta untuk memperluas dokumen XML melalui elemen yang tidak ditetapkan oleh schema.
anyAttribute Membolehkan pencipta untuk memperluas dokumen XML melalui properti yang tidak ditetapkan oleh schema.
appInfo Tetapkan maklumat yang digunakan oleh aplikasi dalam elemen annotation.
attribute 定义一个属性。
attributeGroup 定义在复杂类型定义中使用的属性组。
choice 仅允许在 <choice> 声明中包含一个元素出现在包含元素中。
complexContent 定义对复杂类型(包含混合内容或仅包含元素)的扩展或限制。
complexType 定义复杂类型。
documentation 定义 schema 中的文本注释。
element 定义元素。
extension 扩展已有的 simpleType 或 complexType 元素。
field 规定 XPath 表达式,该表达式规定用于定义标识约束的值。
group 定义在复杂类型定义中使用的元素组。
import 向一个文档添加带有不同目标命名空间的多个 schema。
include 向一个文档添加带有相同目标命名空间的多个 schema。
key 指定属性或元素值(或一组值)必须是指定范围内的键。
keyref 规定属性或元素值(或一组值)对应指定的 key 或 unique 元素的值。
list 把简单类型定义为指定数据类型的值的一个列表。
notation 描述 XML 文档中非 XML 数据的格式。
redefine 重新定义从外部架构文件中获取的简单和复杂类型、组和属性组。
restriction 定义对 simpleType、simpleContent 或 complexContent 的约束。
schema 定义 schema 的根元素。
selector 指定 XPath 表达式,该表达式为标识约束选择一组元素。
sequence 要求子元素必须按顺序出现。每个子元素可出现 0 到任意次数。
simpleContent 包含对 complexType 元素的扩展或限制且不包含任何元素。
simpleType 定义一个简单类型,规定约束以及关于属性或仅含文本的元素的值的信息。
union 定义多个 simpleType 定义的集合。
unique 指定属性或元素值(或者属性或元素值的组合)在指定范围内必须是唯一的。

对数据类型的 XSD 限定

参阅 XSD 限定 / Facets

限定 描述
enumeration 定义可接受值的一个列表
fractionDigits Define the maximum number of decimal places allowed. It must be greater than or equal to 0.
length Define the precise number of characters or list items allowed. It must be greater than or equal to 0.
maxExclusive Define the upper limit of the number. The allowed values must be less than this value.
maxInclusive Define the upper limit of the number. The allowed values must be less than or equal to this value.
maxLength Define the maximum number of characters or list items allowed. It must be greater than or equal to 0.
minExclusive Define the lower limit of the number. The allowed values must be greater than this value.
minInclusive Define the lower limit of the number. The allowed values must be greater than or equal to this value.
minLength Define the minimum number of characters or list items allowed. It must be greater than or equal to 0.
pattern Define the precise sequence of characters accepted.
totalDigits Define the precise number of digits of the Arabic numerals allowed. It must be greater than 0.
whiteSpace Define the processing method for whitespace characters (newline, return, space, and tab).