Harold H. wrote:
It sounds like you might have some experience in this area. Not to
hijack the OP, but could you possibly describe the process you would
go through if you had a completely random pile of binary barf that you
wanted to store as an XML attribute?
Okay, you need to know I am famously lazy. In fact, I think Larry Wall
describing me when he made his well-known remark about programmer
and hubris. Being lazy, the first simple approach I would take is to
enclose the binary data like this:
</enclosing XML tag>
The next step would be to make sure neither the starting or ending CDATA
appears in the enclosed binary data, otherwise this strategy will fail.
The next step after that is to escape (and later unescape) the binary
if needed to assure the uniqueness of the delimiters.
You need to understand that, with a sufficiently large and varied binary
data set, every imaginable character string will appear in the data,
eventually including the delimiters.
This, in turn, means that escaping the data is eventually a requirement,
escaping the data means it will be larger than if this step were not
You should realize that another, possibly better, approach for truly
binary globs is to store them as files, and store links to the files in
XML data set, rather than the raw data itself.