XML technologies / XML Schema / Data type reference / xs:hexBinary
(Excerpt from “XML Schema” by Eric van der Vlist)
Hexadecimal-encoded binary content
Derived from: xs:anySimpleType
Primitive type: xs:hexBinary
Known subtypes: none
Facets: xs:enumeration, xs:length, xs:maxLength, xs:minLength, xs:pattern, xs:whiteSpace
Definition
<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 consists of all binary content; its lexical space simply encodes each octet as its hexadecimal value.
Restrictions
Do not confuse this data type with BinHex encoding, which W3C XML Schema does not support. W3C XML Schema also does not support other popular binary-to-text encodings such as uuXXcode, Quoted Printable, aencode or base85.
The expansion factor is high because each binary octet becomes two characters, four octets if the document is encoded in UTF-16.
Example
A UTF-8 XML header such as
<?xml version="1.0" encoding="UTF-8"?>
would be encoded as:
3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d22223f3e
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de