//递归访问所有节点
void dealXmlFile(QDomElement first)
{QDomNode node = first.firstChild();
while(!node.isNull())
{
if(node.childNodes().count()>1)
{
dealXmlFile(node.toElement());
}
else
{
qDebug()<<"node name:"<<node.toElement().nodeName();
qDebug()<<"node content:"<<node.toElement().text();
}
node = node.nextSibling();
}
}
//主程序
int main(int argc, char *argv[]){
QCoreApplication a(argc, argv);
QDomDocument doc;
QFile xmlFile(xmlFilePath);
if(!xmlFile.open(QIODevice::ReadOnly))
{
qDebug()<<"open xml file failed";
return false;