Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

XML Schema miscellaneous data types


May 28, 2021 XML Schema


Table of contents


XSD miscellaneous data type

This section describes some of the other data types in XML Schema.


Other miscellaneous data types include Boolean, base64Binary, hetegam, floating-point, double-precision, anyURI, anyURI, and NOTATION.


Boolean Data Type

Boolean data is used to specify true or false values.

Here's an example of a logical declaration in a scheme:

<xs:attribute name="disabled" type="xs:boolean"/>

The elements in the document should look something like this:

<prize disabled="true">999</prize>

Note: The legal Boolean values are true, false, 1 (true), and 0 (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 (hexcoded binary data)

Here's an example of a hexBinary declaration in a scheme:

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


AnyURI Data Type

AnyURI data types are used to specify URIs.

Here's an example of anyURI declaration in a scheme:

<xs:attribute name="src" type="xs:anyURI"/>

The elements in the document should look something like this:

<pic src="//www.w3cschool.cn/images/smiley.gif" />

Note: If a URI contains spaces, replace them with %20.


Miscellaneous data types

Name Describe
anyURI
base64Binary
boolean
double
float
hexBinary
NOTATION
Qname


Limiting miscellaneous data types

Qualifications that can be used with miscellaneous data types:

  • enumeration (Boolean data types cannot use this constraint)
  • Length (Boolean data type cannot use this constraint)
  • maxLength (Boolean data type cannot use this constraint)
  • minLength (Boolean data type cannot use this constraint)
  • pattern
  • whiteSpace

Constraint refers to constraint.