If you are sure that mlEventPtr->getComponentName().c_str() returns a wchar_t*, you can directly use that pointer (on Windows, XMLCh* and wchar_t* points to UTF-16 data). If you don't want to use casts all over the place, you can also recompile Xerces with the 'treat wchar_t as a native type' and this will defined XMLCh to be a synonym for wchar_t.

Alberto

Kamdar, Devang (MLITS) wrote:
Hi,
When I am using the following function transcode

XMLCh* xmlChComponentName =
XMLString::transcode(mlEventPtr->getComponentName().c_str());

Compiler is throwing following error:
Error   1       error C2440: 'initializing' : cannot convert from 'char
*' to 'XMLCh *'
c:\working\instrumentation\vc++_projects\mllog4cxx_working\mllog4cxx\sou
rce\mllog4cxx\mlsoaloggerlayout.cpp     78              

mlEventPtr->getComponentName().c_str() returns string of type wchar_t*

I am using Visual Studio 2005 to compile this.

I need to do this transformation, because I need to pass this as a
parameter in DomDodumentPtr->createTextNode() function which accepts
only XMLCh* as a parameter.

Can some one suggest, how to transcode a value of type wcaht_t* to
XMLCh* using the transcode function or by any other way?

Thanks
Devang Kamdar




Reply via email to