xs:simpleType

Purpose This element enables you to define a simple data type in the Tamino Schema Language.
Parent element xs:attribute, xs:element, xs:list, xs:schema (only in the case of named types), xs:union
Child elements xs:list, xs:restriction, xs:union
Attributes final, name
Attributes
Name Type Description
final  

This attribute, in conjunction with the xs:schema element's finalDefault attribute (if the final attribute is not specified, the finalDefault attribute value takes effect), is used when performing schema checks. It specifies the methods that may be used to derive new types from the current simple type. The value is a whitespace-separated list of:

restriction

No type may be derived from this simple type by restriction.

list

No type may be derived from this simple type by the creation of a list type.

union

No type may be derived from this simple type by the creation of a union type.

Alternatively, the special value "#all" prevents all methods of deriving a new type from the current simple type definition.

name xs:NCName

For purposes of reuse, it is possible to specify a name for a simple type definition to be able to reference it later by this name. This is done with the name attribute of the xs:simpleType element.

This attribute is mandatory for the definition of named simple types. For anonymous simple types, however, it must be omitted.

Example 1

This example defines a simple type based on a restriction that only the three values "instrumentalist", "jazzSinger" and "jazzComposer" are allowed for the defined type:

<xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema"
  xmlns:tsd = "http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition">
 .
 .
 .
 <xs:simpleType name="role">
  <xs:restriction base = "xs:NMTOKEN">
    <xs:enumeration value = "instrumentalist"/>
    <xs:enumeration value = "jazzSinger"/>
    <xs:enumeration value = "jazzComposer"/>
  </xs:restriction>
 </xs:simpleType>
 .
 .
 .
</xs:schema>

Example 2

Here is another example showing anonymous simple type definitions:

<xs:element name = "price">
 <xs:simpleType>
   <xs:restriction base='decimal'>
     <xs:totalDigits value='9'/>
     <xs:fractionDigits value='2'/>
   </xs:restriction>
 </xs:simpleType>
</xs:element>