Ivan Bogouchev / Иван Богушев wrote:
2005/11/18, Rafael Sousa (Ext_Altior) <[EMAIL PROTECTED]>:
Hi all!
I'm having trouble working with XMLCh strings...
For example, in the Redirect sample a constant XMLCh string is defined
this way:
static const XMLCh gFileToTrap[] =
{
chLatin_p, chLatin_e, chLatin_r, chLatin_s, chLatin_o, chLatin_n
, chLatin_a, chLatin_l, chPeriod, chLatin_d, chLatin_t,
chLatin_d, chNull
};
But is this the only way? Can't I create one directly from a string of
caracters, like:
static const XMLCh gFileToTrap[] = "personal.dtd";
Hi Rafael,
if your compiler supports it you can use the L macro:
static const XMLCh gS[] = L"something";
I think gcc and vs.net support it.
However I don't know if it is guaranteed that the encodings used by
the macro and Xerces-C are the same.
Can somebody clarify on this?
It's not very portable, unfortunately. It requires the compiler/platform
support Unicode wide string literals, and I believe Windows is the only
one that does consistently.
If you are interested in portable code, the best way to do it is to do
what Xerces-C does.
Dave