XML Schema Tuto...login
XML Schema Tutorial
author:php.cn  update time:2022-04-20 14:13:02

XML Schema Miscellaneous Data Types


XSD Miscellaneous Data Types


Other miscellaneous data types include boolean, base64Binary, hexadecimal, floating point, double, anyURI, anyURI and NOTATION.


Boolean Data Type

Boolean data type is used to specify true or false values.

The following is 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: Legal Boolean values ​​are true, false, 1 (representing true) and 0 (representing 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 (ten Hexadecimal encoded binary data)

The following is an example of hexBinary declaration in a scheme:

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


AnyURI Data Type (AnyURI Data Type)

anyURI data type is used to specify URI.

The following is 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="//m.sbmmt.com/m/xml/../style/images/smiley.gif" />

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


Miscellaneous Data Types

NameDescriptionanyURIbase64BinarybooleandoublefloathexBinaryNOTATIONQName


Restriction on miscellaneous data types (Restriction)

Restrictions that can be used with miscellaneous data types:

  • enumeration (Boolean data type This constraint cannot be used*)

  • length (This constraint cannot be used with Boolean data types)

  • maxLength (This constraint cannot be used with Boolean data types)

  • minLength (Boolean data type cannot use this constraint)

  • pattern

  • whiteSpace

*Translator’s Note: Constraint refers to constraint.