XML Schema reference manual

XSD Element

Element Explanation
all Subelements can appear in any order, and each subelement can appear zero or one time.
annotation The annotation element is a top-level element that specifies the comments of the schema.
any Allow the creator to extend an XML document through elements not specified by the schema.
anyAttribute Allow the creator to extend an XML document through attributes not specified by the schema.
appInfo Specify information that the application must use in the annotation element.
attribute Define an attribute.
attributeGroup Define an attribute group used in complex type definitions.
choice Allow only one element to appear in the containing element within the <choice> declaration.
complexContent Define extensions or restrictions on complex types (including mixed content or elements only).
complexType Define a complex type.
documentation Define text annotations in the schema.
element Define an element.
extension Extend an existing simpleType or complexType element.
field Specify an XPath expression that defines the value used to define the identifier constraint.
group Define a group of elements used in complex type definitions.
import Add multiple schemas with different target namespaces to a document.
include Add multiple schemas with the same target namespace to a document.
key Specify that an attribute or element value (or a set of values) must be within a specified range of keys.
keyref Specify that the value of an attribute or element (or a set of values) corresponds to the value of a specified key or unique element.
list Define a simple type as a list of values of a specified data type.
notation Describe the format of non-XML data in an XML document.
redefine Redefine simple and complex types, groups, and attribute groups obtained from external schema files.
restriction Define constraints on simpleType, simpleContent, or complexContent.
schema Define the root element of the schema.
selector Specifies an XPath expression that selects a set of elements based on the constraint.
sequence Requires child elements to appear in order. Each child element can appear 0 to any number of times.
simpleContent Contains extensions or restrictions of complexType elements and does not contain any elements.
simpleType Define a simple type, specify constraints, and provide information about the value of attributes or elements that contain only text.
union 定义多个 simpleType 定义的集合。
Define a collection of multiple simpleType definitions. unique

Specify that the value of a property or element (or a combination of a property or element value) must be unique within the specified range.

XSD Restrictions/Facets for Datatypes

See XSD restriction / Facets restriction
description Define a list of acceptable values
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 handling of whitespace characters (new lines, carriage returns, spaces, and tab characters).