Built-in Simple Types

Contact Us or call 1-877-932-8228
Built-in Simple Types

Built-in Simple Types

XML Schema specifies 44 built-in types, 19 of which are primitive.

19 Primitive Data Types

The 19 built-in primitive types are listed below.

  1. string
  2. boolean
  3. decimal
  4. float
  5. double
  6. duration
  7. dateTime
  8. time
  9. date
  10. gYearMonth
  11. gYear
  12. gMonthDay
  13. gDay
  14. gMonth
  15. hexBinary
  16. base64Binary
  17. anyURI
  18. QName
  19. NOTATION

Built-in Derived Data Types

The other 25 built-in data types are derived from one of the primitive types listed above.

  1. normalizedString
  2. token
  3. language
  4. NMTOKEN
  5. NMTOKENS
  6. Name
  7. NCName
  8. ID
  9. IDREF
  10. IDREFS
  11. ENTITY
  12. ENTITIES
  13. integer
  14. nonPositiveInteger
  15. negativeInteger
  16. long
  17. int
  18. short
  19. byte
  20. nonNegativeInteger
  21. unsignedLong
  22. unsignedInt
  23. unsignedShort
  24. unsignedByte
  25. positiveInteger

Defining a Simple-type Element

A simple-type element is defined using the type attribute.

Code Sample:

SimpleTypes/Demos/Author.xsd
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="Author">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="FirstName" type="xs:string"/>
				<xs:element name="LastName" type="xs:string"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

Notice the FirstName and LastName elements in the code sample above. They are not explicitly defined as simple type elements. Instead, the type is defined with the type attribute. Because the value (string in both cases) is a simple type, the elements themselves are simple-type elements.

Next