I know this question has probably been discussed before, but I just want to see if there are any new solutions.
 
Basically I need to convert the XMLCh* to a std::wstring and vice versa. In Xerces, XMLCh is typdef-ed to unsigned short (2 bytes). Under win32, there is no need for conversion since wchar_t is also typedef-ed to unsigned short. In Solaris/Linux/VMS, however, wchar_t is typedef-ed to unsigned long (4 bytes), so the conversion seem to be inevitable.
 
My question is: Does Xerces implementation requires that the size XMLCh to be 2 bytes?  if I change the typedef of XMLCh to wchar_t and recompile the xerces, would it work? I know the answer is probably no, but I just want to make sure. Of course the memory usage will be doubled if we change the XMLCh to 4 bytes, but that is not a concern for me.
 
If the conversion is inevitable, does xerces provide some helper classes/functions to do that?
 
Any suggestions are greatly appreciated.
 
 
 
Qi Chen
Micron Tech.
 
 

Reply via email to