Hi there,

I am sending XML data that contains international characters to a domino server(on win 
2k) using the http server and DSAPI.
For example, following example would contain the japanese character (say 0x65E5)
My XML data would look something like this

<?xml version="1.0" encoding="utf-8"?>
<method name="somMethodName">
<prop name="0Firstname type="string">
Hi?
</prop>
</method>

(the question mark is just a place holder for the japanese character)

I need to extract the prop value and place it in a WCHAR becuase the method I'm 
calling is expecting wide
characters. Do I need to do any conversions from XMLCh to WCHAR.  I figure I would use 
the XMLString::Transcode method, then call mbcstows method to convert to wchar  I've 
read in the some post that XMLCh has the same type def as.

Below is my characters method from my SAX2 handler

void DsapiSax2Handler::characters
(
const XMLCh* const pChars,
const unsigned int uiLength
)
        {
        switch (m_uiParserState)
                {
                case STATE_EXPECT_METHOD:
                        {
                        printf("Expect method");
                        }

                        break;  //      STATE_EXPECT_METHOD
                case STATE_EXPECT_PROP:
                        {

                        char* pValue = XMLString::transcode(pChars);

                        printf("Looking in pValue\n");

                        int i = 0;
                        while (true)
                                {
                                if (pValue[i] == 0)
                                        {
                                        printf("Breaking out of loop 1\n");
                                        break;
                                        }

                                int ch = pValue[i];
                                printf("pValue=%d\n", ch);

                                i++;
                                }
                                
                        unsigned int uiReqSize = 0;
                        unsigned int uiConvertedBytes = 0;

                        uiReqSize = mbstowcs(0, pValue, MB_CUR_MAX);
                        printf("Required size of wchar = %d\n", uiReqSize);

                        WCHAR* pwcValue = (WCHAR*) malloc((sizeof(WCHAR) * uiReqSize) 
+ 1);
                        memset(pwcValue, '\0', (sizeof(WCHAR) * uiReqSize) + 1);

                        uiConvertedBytes = mbstowcs(pwcValue, pValue, uiReqSize);
                        printf("Number of converted bytes = %d\n", uiConvertedBytes);
                        printf("wide character: %lS\n\n", pwcValue);

                        printf("Looking in pwcValue\n");

                        i = 0;
                        while (true)
                                {
                                if (pwcValue[i] == 0)
                                        {
                                        printf("Breaking out of loop 2\n");
                                        break;
                                        }

                                int ch = pwcValue[i];
                                printf("pwcValue=%d", ch);

                                i++;
                                }

                        printf("Done\n");
                        free(pwcValue);
                        XMLString::release(&pValue);
                        }

                        break;  //      STATE_EXPECT_PROP
                default:
                        break;
                }
        }

thanks
fred



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

Reply via email to