I am being passed a byte array representing a pdf as part of an xml node.
the byte array int the xml looks like this
<Document>
Xh0XQo+PgovVHlwZSAvDAwIG4gCjAwMDAxNTc0MjkgMDAwMDAgbiAKMDAwMDE1ODQ1NSAwMDAwMCBuIAowMDAwMTU5MzY1IDAwMDAwIG4gCjAwMDAxNTk2MjEgMDATg5MyAwMDAwMCBuIAowMDAwMTYwMTQzIDAwMDAwIG4gCjAwMMDE2MDYzNSAwMDAwMCBuIAowMDAwMTYwODk5IDAwMDAwIG4gCjAwMDAxNNTkgMDAwMDAgbiAwMDE2NDkxMiAwMDAwMCBuIAowMDAwMTY1MTwMDAwIG4gCjAwMDAxNjU0MzYgMDAwMDE2NTUyMyAwMDAwMCBuIAowMDAwMTY1NzA5IDAwMDAwIG4gCjAwMDAxNjU5MjcgMDAwMDAgbiAKMDA4MTg3OSAwMDAwMCBuIAowMMTgxOTc4IDAwMDAwIG4gCnRyYWlsZXIKPDwvU2l6ZSAxMTMxCi9Sb290IDEgMCBSCi9JbmZvIDMgMCBSCi9JRCBbPDgyMTQwQURDM0QwOTRCREZBODI2MjM4Q0VBM0YxODA3PiA8ODIxNDBBREMzRDA5NEJERkE4MjYyMzhDRUEzRjE4MDc+XQovRW5jcnlwdCA0IDAgUgo+PgpzdGFydHhyZWYKMTgyMDEzCiUlRU9GCg...........</Document>
So I first copy the bytearray into a string variable .
string pdfbyte = GetNodeUsingXpath(xpath.....);
Now I would like to cast this pdfbyte into a byte array.
byte[] output = (byte[])pdfbyte;
byte[] output = byte.parse(pdfbyte);
These dont work.
I have looked online but could not find a simple solution to cast a byte array stored in a string variable to a byte array. Any pointers would be helpful.
Basically, I would like to copy the bytearray that is being sent as part of the xml into a byte array variable.
GetNodeUsingXpathactually return here? Is the data base64-encoded, by any chance?