Every string in Xerces is UTF-16, so you cannot cast to char* and get the complete value (if the UTF-16 string for your data is 'K', 0, 'r', 0, 'i', 0 etc.. so treating it as char* will print just 'K'). If you plan to print the string you should use XMLString::transcode (and call XMLString::release after using it); otherwise you should try to always work with UTF-16 to avoid losing informations by converting it to a locale that could be unable to encode all the possible Unicode characters.

Alberto

[email protected] wrote:
Hi,

   I am trying to read the attribute from XML file, but I am failing to read it 
completely.

   Here is the code snippet and the details :

  1)//////////////////////////////////////////////////////////

    XMLCh * strAttr="name";
    char * strTemp = NULL;

    strTemp = (char*)domElement->getAtribute(strAttr);
    printf("%s",strTemp);

   //////////////////////////////////////////////////////////

   XML node looks like this :

   <MyName name="Krishna" value="10"/>

  //////////////////////////////////////////////////////////

   Problem :

    When read the attribute and try to print, it is printing only 'K', instead of 
"Krishna".
    Kindly help to resolve this.

 /////////////////////////////////////////////////////////////

  Platform :

            x86
            Qnx 6.4.1
            Xerces 2.8 (The source was built on Qnx and same being used)



  Please help me to resolve this problem.

Thanks,
Krishna






Confidentiality Notice

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 confidential or privileged information. If you are not the intended recipient, please notify
the sender at Bharat Electronics  or [email protected] immediately
and destroy all copies of this message and any attachments.



Reply via email to