At 16.02 20/07/2004 +0200, Alexander Broekhuis wrote:
Hi,

>>At the moment I am trying to use this:
>>------------------------------------------------------------------------
>>MemBufInputSource *memBufIS = new MemBufInputSource((const XMLByte*)xml,
>>wcslen(xml), "xmlRecord", false); // In this line xml is the LPTSTR that
>>contains the xml.
>
> The MemBufInputSource works on buffers of XMLByte, so the length must be
> in
> bytes; wcslen returns the number of wchar_t (or XMLCh, on Windows), so you
> need to multiply it by 2. Or, to be on the safe side, you should always
> use
> TCHAR-based code, like this
>
> MemBufInputSource *memBufIS = new MemBufInputSource((const XMLByte*)xml,
> _tcslen(xml)*sizeof(TCHAR), "xmlRecord", false);
>

This is an other problem then that i have, thx for the hint btw :), I
changed that piece of code.
The problem I have is the the XMLByte only contains the first char of xml.

No, that's just a display problem; you are looking at a piece of Unicode data, that is 2 character wide. When that string contains a normal ASCII character, the second char is 0, so if you read it as it was a normal ASCII string you only see the "<" string. If you are inside Visual Studio (as I guess, given that you deal with TCHAR types...) go to Tools | Options | Debug and check the "Display Unicode Strings" check box.
If you need to display the value of a variable that is not declared to be a LPTSTR, enter a watch expression like "xml,su" (where ",su" means "display as it were a Unicode string")


Alberto



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to