You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
823 B
C++
37 lines
823 B
C++
#include "nmXmlUtils.h"
|
|
|
|
bool nmXmlUtils::loadNmXmlDatas(vecNmXmlDatas* pVecNmXmlDatas, \
|
|
QString sFile)
|
|
{
|
|
if (NULL == pVecNmXmlDatas)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// 加载
|
|
QDomDocument doc;
|
|
if (!openAndLoadXml(doc, sFile, true)) //第三个参数:加密模式
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// 具体的解析
|
|
QDomElement root = doc.documentElement();
|
|
QDomNodeList listNodes = root.childNodes();
|
|
|
|
pVecNmXmlDatas->clear();
|
|
for (int i = 0; i < listNodes.count(); i++)
|
|
{
|
|
QDomNode node = listNodes.at(i);
|
|
QDomElement e = node.toElement();
|
|
|
|
nmXmlData* p = new nmXmlData();
|
|
Q_ASSERT (NULL != p);
|
|
p->parseInfo(e);
|
|
pVecNmXmlDatas->append(p);
|
|
}
|
|
|
|
return (pVecNmXmlDatas->count() > 0);
|
|
}
|
|
|