The most common way of doing this is to include the binary as base-64 in an element. However, this is a workaround, and adds a bit of volume to the file.
For example, this is the bytes 00 to 09 (note we needed 16 bytes to encode 10 bytes worth of data):
<xml><image>AAECAwQFBgcICQ==</image></xml>
how you do this encoding varies per architecture. For example, with .NET you might use Convert.ToBase64String
, or XmlWriter.WriteBase64
.