You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bluesky-dev@incubator.apache.org by SamuelKevin <lo...@gmail.com> on 2010/12/18 08:17:32 UTC
some suggestion about XML message API
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/
Re: some suggestion about XML message API
Posted by SamuelKevin <lo...@gmail.com>.
i've figured a maximum message filed, could you give me some suggestion if
it's not completed.
用户姓名: Str_StuName
用户密码: Str_StuPasswd
节点类型: Str_UserType
用户ip地址:Str_StuIP
端口信息:Str_StuAuPort,Str_StuViPort,Str_StuScPort, Str_StufAuPort1,
Str_StufAuPort2, Str_StuViPort1, Str_StuViPort2
课堂信息: Str_ClassRoomID
焦点学生: Str_StuAppFocus
what else do i need to add?
regards,
Kevin
2010/12/18 李重重 <li...@gmail.com>
> I cannot agree more with you!
>
> 2010/12/18 SamuelKevin <lo...@gmail.com>
>
> > 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/
> >
>
--
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/
Re: some suggestion about XML message API
Posted by 李重重 <li...@gmail.com>.
I cannot agree more with you!
2010/12/18 SamuelKevin <lo...@gmail.com>
> 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/
>