Hi

I am using SAX2XMLReader class in Xerces 2.8 for scanning and validating
certain data fields in an XML document.

My code involves a class which is derived from DefaultHandler and
overriding the startElement. stopElement and characters callback
functions for capturing and analyzing the data.

Everything works perfectly for my except that I have a XML element which
value is in Chinese. So when the DefaultHandler::characters callback API
is invoked I need to store those Chinese characters to the C++
std::string format. For this purpose I use the XMLString::transcode
function.

void MyDefaultHandler::characters(const XMLCh* const chars,const
unsigned int length)
{
    //update the value/data of the attribute

    char * tempattr_val = (char *)XMLString::transcode(chars);
    m_value = string( tempattr_val );
    XMLString::release(&tempattr_val);
}

But after running the application with an XML document containing the
Chinese characters , I realized that the transcode( ) API returns a
blank empty string . With English characters it works fine but somehow I
am unable to retain those Chinese characters.

Any help will be greatly appreciated

Regards
Shyam

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com

Reply via email to