Instead of the overhead with saving binary as Base64, I was wondering if you could directly store double-byte binary streams into XML files, using CDATA, or commenting it out, or something?
+4
A:
The Nul character ( '\0' in C ) is not valid anywhere in XML, even as an escape ( & #0; ).
Pete Kirkham
2009-02-02 11:07:14
I suppose because XML files are null-terminated.
Jenko
2009-02-02 11:12:04
@Jeremy: They aren't. Null is just not a valid XML character, likely because of null-terminated strings in a popular programming language...
Christoph
2009-02-02 11:34:35
Note that the standard is not 100% clear about this. The character range definitions exclude the 0 byte but some other texts say that any character below 127 is valid.
Aaron Digulla
2009-02-02 12:29:31
@Aaron: http://www.w3.org/TR/xml/#charsets should be pretty clear...
Christoph
2009-02-02 12:33:44
Doesn't that mean no you can't, since 0-8,B,C,E,F FFFE, and FFFF are invalid characters?
David Sykes
2010-04-28 10:32:19
+3
A:
XML is a plain-text format - don't use it to store binary data. Put the binary blobs in separate files and add an element to your XML which references these files. If you want to store all binary blobs in a single file, add an offset attribute or something like that...
Christoph
2009-02-02 11:27:48