ares_games
ares_games

Reputation: 1067

Real binary block in XML (C++)?

Is it possible to integrate a real (not encoded in characters) binary block (best with defined byte-order and word-length) into an XML file?

Upvotes: 5

Views: 320

Answers (1)

evil otto
evil otto

Reputation: 10582

No, it is not possible while keeping within the xml standard.

The allowable set of characters in a parsed XML entity is tab, carriage return, linefeed, and valid unicode characters. There are various bytes that fall outside of this allowable range, most prominently 0x0, but also 0x1 - 0x8, 0xB - 0xC, and 0xE - 0x1F (i.e., most values that are classically ASCII control characters).

You can't even include them as numeric entities, since they aren't valid characters. i.e., the following will not validate:

<test>
    Testing ^A: &#x1;
</test>

See http://www.w3.org/TR/2006/REC-xml11-20060816/#charsets

Upvotes: 7

Related Questions