Passing Strings encoded BASE64 in XML
-
I want to use XML to transport some data across HTTP protocol. When text in some element contains US ASCI characters then all is OK. But when some language- specific characters appear i get error. I want to encode contents of some elements (these that contain these unfortunate characters) to BASE.64. when I do the following, I get error. _variant_t var_val=GetSomeText_WithStrangeChars() ..check errorcodes... pNewNodeOut->put_dataType(L"bin.base64"); ..check errorcodes... //ok it works so far pNewNodeOut->put_nodeTypedValue(var_val); //HERE CRASH //It is here where HRESULT is E_FAIL The first question is: What to do to avoid error, and to sucessfully put value of _variant_t (containing BSTR) into element whose type is set to bin.base64 ? The last question is: Shall I be able to automatically get the value of the element without explicit converting it from BASE.64 ? I mean : Shall MSXML parser do the conversion automatically for me when I will call nodeTypedValue property ? Thanks Michal Januszczyk
-
I want to use XML to transport some data across HTTP protocol. When text in some element contains US ASCI characters then all is OK. But when some language- specific characters appear i get error. I want to encode contents of some elements (these that contain these unfortunate characters) to BASE.64. when I do the following, I get error. _variant_t var_val=GetSomeText_WithStrangeChars() ..check errorcodes... pNewNodeOut->put_dataType(L"bin.base64"); ..check errorcodes... //ok it works so far pNewNodeOut->put_nodeTypedValue(var_val); //HERE CRASH //It is here where HRESULT is E_FAIL The first question is: What to do to avoid error, and to sucessfully put value of _variant_t (containing BSTR) into element whose type is set to bin.base64 ? The last question is: Shall I be able to automatically get the value of the element without explicit converting it from BASE.64 ? I mean : Shall MSXML parser do the conversion automatically for me when I will call nodeTypedValue property ? Thanks Michal Januszczyk
Passing binary or base64 information around may be easiest if you use SOAP - here is information on building a SOAP tool in VC: C++ SOAP client for MS SOAP Toolkit 1.0
For more basic non-VC :zzz: introductory base64 information try this XML and Binary Data article and MXSML based class module to perform Base64 encoding and decoding and Class object for Base64 conversion with .NET