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?
Binary XML is typically used in applications where the performance of standard XML is insufficient, but the ability to convert the document to and from a form (XML) which is easily viewed and edited is valued. Other advantages may include enabling random access and indexing of XML documents.
In many cases, XML files are both machine-generated and machine-consumed. In other words, many XML text files aren't used directly by humans. This is the rather paradoxical aspect of XML technology—it's text-based and non-binary, but is often used as though it's binary.
There are two methods of encoding binary data in an XML document. The base64Binary encoding makes better use of the available XML characters, and on average a base64-encoded binary field is 2/3 the size of its hexBinary equivalent. Base64Binary is widely used by the MIME format and by various XML-based standards.
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: 
</test>
See http://www.w3.org/TR/2006/REC-xml11-20060816/#charsets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With