XSD Miscellaneous Data Types
Other miscellaneous data types include boolean, base64Binary, hexBinary, float, double, anyURI, and NOTATION.
Boolean Data Type
The Boolean data type is used to specify true or false values.
Below is an example of a logical declaration in a schema:
The element in the document should look like this:
Note: Valid boolean values are true, false, 1 (indicating true), and 0 (indicating false).
Binary Data Types
Binary data types are used to represent binary data.
We can use two types of binary data:
base64Binary (Base64 encoded binary data)
hexBinary (Hexadecimal encoded binary data)
Below is an example of a hexBinary declaration in a schema:
AnyURI Data Type
The anyURI data type is used to specify a URI.
Below 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 (cannot be used with boolean data types)
length (cannot be used with boolean data types)
maxLength (cannot be used with boolean data types)
minLength (cannot be used with boolean data types)
pattern
whiteSpace