Manual de Referência do XML Schema

XSD Element

Element Explanation
all Define that child elements can appear in any order, and each child element can appear zero or one time.
annotation The annotation element is a top-level element that defines the annotations of the schema.
any Allow creators to extend the XML document with elements not specified by the schema.
anyAttribute Allow creators to extend the XML document with attributes not specified by the schema.
appInfo Define the information that the application needs to use in the annotation element.
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 definir o número máximo permitido de casas decimais. Deve ser maior ou igual a 0.
length definir o número exato permitido de caracteres ou itens da lista. Deve ser maior ou igual a 0.
maxExclusive definir o limite superior do número. Os valores permitidos devem ser menores que este valor.
maxInclusive definir o limite superior do número. Os valores permitidos devem ser menores ou iguais a este valor.
maxLength definir o número máximo permitido de caracteres ou itens da lista. Deve ser maior ou igual a 0.
minExclusive definir o limite inferior do número. Os valores permitidos devem ser maiores que este valor.
minInclusive definir o limite inferior do número. Os valores permitidos devem ser maiores ou iguais a este valor.
minLength definir o número mínimo permitido de caracteres ou itens da lista. Deve ser maior ou igual a 0.
pattern definir a sequência exata de caracteres aceitáveis.
totalDigits definir a precisão do número árabe permitido. Deve ser maior que 0.
whiteSpace definir o tratamento de caracteres de espaço branco (quebra de linha, Enter, espaço e tabulação).