Hi,
I have a strange problem with strings concatenation. I have a xmlobj, which contains request, response, status, notification and control which are all of type std::string.
When I dump that, it prints every member variable properly. But when I concatenate as below, "response" string alone is not appended. though the data is there.
Please help me to fix this problem
Thanks
rsennat
I have a strange problem with strings concatenation. I have a xmlobj, which contains request, response, status, notification and control which are all of type std::string.
When I dump that, it prints every member variable properly. But when I concatenate as below, "response" string alone is not appended. though the data is there.
Please help me to fix this problem
Thanks
rsennat
Code:
xmlobj.XmlDump();
string xmlMessage;
xmlMessage.reserve(300);
xmlMessage = "<tagmessage>";
xmlMessage += "<tagrequest>";
xmlMessage += xmlobj.GetRequest();
xmlMessage += "</tagrequest>";
xmlMessage += "<tagstatus>";
xmlMessage += xmlobj.GetStatus();
xmlMessage += "</tagstatus>";
xmlMessage += "<tagnotification>";
xmlMessage += xmlobj.GetNotifMsg();
xmlMessage += "</tagnotification>";
xmlMessage += "<tagcontrol>";
xmlMessage += xmlobj.GetCtrlMsg();
xmlMessage += "</tagcontrol>";
xmlMessage += "<tagresponse>";
xmlMessage += xmlobj.GetResponseMsg(); [B]--> not appended here[/B]
cout << "IN XML ENCODE: " << xmlobj.GetResponseMsg().c_str() << endl; [B]--> this prints the data properly[/B]
xmlMessage += "</tagresponse>";
xmlMessage += "</tagmessage>";
printf("XML message is:: %s\n", xmlMessage.c_str());
Comment