Skip to main content

XSD Binary

Binary data types are used to represent binary values.

Binary Data Type

The binary data types are used to represent binary values. Two binary types are common in use:

  • base64Binary: represents base64 encoded binary data
  • hexBinary: represents hexadecimal encoded binary data

Let's see an example:

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

and an element in your XML document look like this:

<blob>9FEFE</blob>

Restrictions on Binary Data Type

Restrictions that can be used with binary data type:

  • enumeration
  • length
  • maxLength
  • minLength
  • pattern
  • whiteSpace

See XSD Restrictions chapter to learn more.