You do have to convert the raw binary to hexadecimal (or base64) representation. Eg, if the value of the byte is 255 (in decimal), it's hex representation (as a string) would be "ff".
The (conventional) type to use for storing the raw input is unsigned char, so you can get the ranges 0-255 easily byte by byte, but for each byte of that array, you need two bytes in a signed char (or std::string) type to store the representation, and that is what you use in the XML.
Your framework probably has a method for converting raw bytes to Base64 or hex. If not, here's one method for hex:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main (void) {
ostringstream os;
os.flags(ios::hex);
unsigned char data[] = { 0, 123, 11, 255, 66, 99 };
for (int i = 0; i < 6; i++) {
if (data[i] < 16) os << '0';
os << (int)data[i] << '|';
}
string formatted(os.str());
cout << formatted << endl;
return 0;
}
Outputs: 00|7b|0b|ff|42|63|