Simple data types

Simple type elements are defined in the XML schema by using the empty element. The simple type elements fall down into the following categories:

Declaring an element containing text only

<xs:element name="name" type="type" />

XML schema supports a number of build-in data types to specify the element type. The build-in types belong to the XML schema namespace, which can be indicated as follows:

<xs:element name="name" type="xs:type" />
Example:
<xs:element name="lastName" type="xs:string" />

Declaring an attribute

Every single attribute is by definition a simple type element. The syntax is as follows with an obvious meaning of the keywords:

<xs:attribute name="name" type="type" default="default" fixed="fixed" use="usage" />

The attributes use the same collection of data types as the elements. The optional attribute use can take on the following values:

Example:
<xs:attribute name="gender" type="xs:string" default="male" />