XSD Data Types

Built-in XML Schema data types for validating element content and attribute values. Using typed elements catches data errors at parse time rather than application logic.

Syntax

xml-fundamentals
xs:string, xs:integer, xs:decimal, xs:boolean
xs:date (YYYY-MM-DD), xs:dateTime, xs:time
xs:anyURI, xs:base64Binary, xs:ID, xs:IDREF
xs:positiveInteger, xs:nonNegativeInteger

Example

xml-fundamentals
<xs:element name="price" type="xs:decimal"/>
<xs:element name="date" type="xs:date"/>
<xs:element name="active" type="xs:boolean"/>
<xs:attribute name="id" type="xs:ID" use="required"/>