Latest web development tutorials

XML Schema simpleType element

XML Schema Reference Complete XML Schema Reference

Definition and Usage

simpleType element defines a value related to information and their simple type constraints, regulations and having a plain text content of an element or attribute.

Element Information

  • Parent element: attribute, element, list, restriction , schema, union

grammar

<simpleType
id=ID
name=NCName
any attributes
>

(annotation?,(restriction|list|union))

</simpleType>

(? Sign declares that the element can occur zero or one time in simpleType element.)

属性 描述
id 可选。规定该元素的唯一的 ID。
name

类型名称。 该名称必须是在 XML 命名空间规范中定义的无冒号名称 (NCName)。

如果指定,该名称在所有 simpleType 和 complexType 元素之间必须是唯一的。

如果 simpleType 元素是 schema 元素的子元素,则为必选项,在其他时候则是不允许的。

any attributes 可选。规定带有 non-schema 命名空间的任何其他属性。

Example 1

In this case the statement "age" element is a simple type with a restriction. The value of age can not be less than 0 or greater than 100:

<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>


XML Schema Reference Complete XML Schema Reference