hi all:
I find it very inconvenience to use current xml API. For example, if i
want to create a login message, i need to write down the following code
like:
msg.SetCmd(STUDENT_STATUS);
QList<QHostAddress> NetList = QNetworkInterface::allAddresses();
for(int Neti = 0;Neti < NetList.count(); Neti++)
{
strIP = NetList.at(Neti).toString();
if(strIP != "127.0.0.1")
break;
}
//need to access user info from config dialog
StuPwd = "123456";
StuName = "liuchen";
pMap.insert("Str_StuPasswd", StuPwd);
//warp studentName
pMap.insert("Str_StuName",StuName);
//warp ipaddress
qsNode = QString(strIP);
pMap.insert("Str_StuIP", qsNode);
//insert 7 ports
pMap.insert("Str_StuAuPort", tr(""));
...........................
if i want send a join in message, i need to write the same long
section of code again because the current XML create/parser API could
only create new xml message instead of update certain section. It is
time consuming. And the code is not redundant. I wish the API would be
improved soon. Currently, i create the xml message once, including all
the section we would use in our system, and every time a new message
need to be sent, i just replace it (as a QString) in certain section.
regards,
Kevin
--
Bowen Ma a.k.a Samuel Kevin @ Bluesky Dev Team XJTU
Shaanxi Province Key Lab. of Satellite and Terrestrial Network Tech
http://incubator.apache.org/bluesky/