XML Schema 参考手册 完整 XML Schema 参考手册 The simpleType element defines a simple type that specifies information about and constraints on the values of elements or attributes with plain text content. 父元素: Attribute, element, list, restriction, schema, union (? The symbol declaration element can appear zero or once in the simpleType element.) Attribute Description Id Optional. Specifies the unique ID of the element. Name Type name. The name must be a colon-free name (NCName) defined in the XML namespace specification. If specified, the name must be unique among all simpleType and complexType elements. Required if the simpleType element is a child of the schema element, which is not allowed at other times. Any attributes Optional. Specifies any other attributes with the non-schema namespace. This example declares that the “age” element is a simple type with constraints. The value of age cannot be less than 0 or greater than 100:Definition and usage ¶
Element information ¶
Grammar ¶
<simpleType
id=ID
name=NCName
*any attributes*
>
(annotation?,(restriction|list|union))
</simpleType>
Example 1 ¶
<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>