<xsd:simpleType> Element

Defines a simple type, which determines the constraints on and information about the values of attributes or elements with text-only content.

  final = (#all | (list | union | restriction)) 
  id = ID 
  name = NCName 
  {any attributes with non-schema Namespace}...>
Content: (annotation?, (restriction | list | union))


  • final
    The type of derivation. The final attribute prevents the specified type of derivation of this simpleType element. This value can contain #all or a list that is a subset of list, union, or restriction.


    Prevents derivation by list.


    Prevents derivation by union.


    Prevents derivation by restriction.


    Prevents all derivation (list, union, restriction).


  • id
    The ID of this element. The id value must be of type ID and be unique within the document containing this element.


  • name
    The name of the type. The name must be a no-colon-name (NCName) as defined in the XML Namespaces 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, and not allowed at other times.

Element Information

Number of occurrences


Parent elements

attribute, element, list, restriction (simpleType), schema, union


annotation, list, restriction (simpleType), union


Simple types are defined by deriving them from existing simple types (built-in data types and derived simple types). A simple type cannot contain elements and cannot have attributes.

Simple types can be defined in one of the following ways.


Restricts the range of values for the simple type to a subset of those for inherited simple type.


Defines a simple type that contains a white space-separated list of values of an inherited simple type.


Defines a simple type that contains a union of the values of two or more inherited simple types.

A simpleType declaration contained within a complexType or attribute element defines that simple type within the scope of the complexType or attribute that contains it. If a simpleType declaration has the schema element as its parent, it has global scope within that schema.

After a simple type is defined, it can be used in an attribute or element declaration or complexType (which, in turn, can be used in an element declaration) definition.


The following examples show simple type definitions using restriction, list, and union elements.


The following shows a simple type (freezeboilrangeinteger) that restricts an integer value to be within the range of a minimum value of 0 and a maximum value of 100.

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


The following shows a simple type (listOfDates) that allows a list of dates (each list item date must be separated by white space) as its contents.

<xs:simpleType name="listOfDates">
  <xs:list itemType="xs:date"/>


The following shows a simple type (allframesize) that exists as a union of two other simple types that define sets of enumerated values; one that provides road bike sizes as a set of integer-based values and the other which enumerates string values for mountain bike sizes (i.e. 'large', 'medium', 'small').

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="allframesize">
        <xs:restriction base="roadbikesize"/>
        <xs:restriction base="mountainbikesize"/>

<xs:simpleType name="roadbikesize">
  <xs:restriction base="xs:positiveInteger">
    <xs:enumeration value="46"/>
    <xs:enumeration value="52"/>
    <xs:enumeration value="55"/>

<xs:simpleType name="mountainbikesize">
  <xs:restriction base="xs:string">
    <xs:enumeration value="small"/>
    <xs:enumeration value="medium"/>
    <xs:enumeration value="large"/>

Other Resources

For more information see the W3C XML Schema Part 1: Structures Recommendation at www.w3.org/TR/2001/REC-xmlschema-1-20010502/\#element-al.

See Also


XML Schemas (XSD) Reference
XML Schema Elements