XSD Miscellaneous Data Types
Other miscellaneous data types include boolean, base64Binary, hex, float, double, anyURI, anyURI, and NOTATION.
Boolean Data Type
The boolean data type is used to specify true or false values.
The following is an example of a boolean declaration in a schema:
The element in the document should look like this:
Note: Legal boolean values are true, false, 1 (meaning true), and 0 (meaning false).
Binary Data Types
Binary data types are used to express data in binary form.
We can use two binary data types:
- base64Binary (Base64-encoded binary data)
- hexBinary (hexadecimal-encoded binary data)
The following is an example of a hexBinary declaration in a schema:
AnyURI Data Type
The anyURI data type is used to specify a URI.
The following is an example of an anyURI declaration in a schema:
The element in the document should look like this:
Note: If a URI contains spaces, replace them with %20.
Miscellaneous Data Types
| Name | Description |
|---|---|
| anyURI | |
| base64Binary | |
| boolean | |
| double | |
| float | |
| hexBinary | |
| NOTATION | |
| QName |
Restriction on Miscellaneous Data Types
Restrictions that can be used with miscellaneous data types:
- enumeration (this constraint cannot be used with the boolean data type*)
- length (this constraint cannot be used with the boolean data type)
- maxLength (this constraint cannot be used with the boolean data type)
- minLength (this constraint cannot be used with the boolean data type)
- pattern
- whiteSpace
*Translator's note: the term means constraint.