Name

xs:hexBinary — Binary contents coded in hexadecimal.

Derived from:

xs:anySimpleType

Primary:

xs:hexBinary

Known subtypes:

none

Facets:

xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace

<xs:simpleType name="hexBinary" id="hexBinary">
  <xs:restriction base="xs:anySimpleType">
    <xs:whiteSpace value="collapse" fixed="true"/>
  </xs:restriction>
</xs:simpleType>

Description

The value space of xs:hexBinary is the set of all binary contents; its lexical space is a simple coding of each octet as its hexadecimal value.

Restrictions

This datatype should not be confused with another encoding called BinHex that is not supported by W3C XML Schema. Other popular binary text encodings (such as uuXXcode, Quote Printable, BinHex, aencode, or base85, to name few) are not supported by the W3C XML Schema.

The expansion factor is high since each binary octet is coded as two characters (i.e., four octets if the document is encoded with UTF-16).

Example

A UTF-8 XML header such as:

"<?xml version="1.0" encoding="UTF-8"?>"

encoded would be:

"3f3c6d78206c657673726f693d6e3122302e20226e656f636964676e223d54552d4622383e3f"

Get XML Schema now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.