QString qqq; qqq = QString::fromLocal8Bit("<configuration><reactions><parameter psevdonim=\"NONEACTION\" extraInfo=\"Отсуствие реакции\" /><parameter psevdonim=\"CALLABONENT\" extraInfo=\"Звонок абоненту\" /></reactions></configuration>"); domDocument.setContent(qqq, true, &errorStr, &errorLine, &errorColumn); QDomElement root = domDocument.documentElement(); QDomElement sysMessElement = root.firstChildElement("reactions"); QDomNodeList sysMessParams = sysMessElement.elementsByTagName("parameter"); QDomElement parameter; for (int p=0; p<sysMessParams.count(); p++) { parameter = sysMessParams.item(p).toElement(); QString asd; asd = parameter.attribute("extraInfo").toLocal8Bit(); std::string qwe = asd.toStdString(); }
#include <QtCore/QCoreApplication>#include <QDomDocument>int main(int argc, char *argv[]){ QCoreApplication a(argc, argv); QString errorStr; int errorLine; int errorColumn; QDomDocument domDocument; QString qqq; qqq = "<configuration><reactions><parameter psevdonim=\"NONEACTION\" extraInfo=\"Отсуствие реакции\" /><parameter psevdonim=\"CALLABONENT\" extraInfo=\"Звонок абоненту\" /></reactions></configuration>"; domDocument.setContent(/*device*/qqq, true, &errorStr, &errorLine, &errorColumn); QDomElement root = domDocument.documentElement(); QDomElement sysMessElement = root.firstChildElement("reactions"); QDomNodeList sysMessParams = sysMessElement.elementsByTagName("parameter"); QDomElement parameter; for (int p=0; p<sysMessParams.count(); p++) { parameter = sysMessParams.item(p).toElement(); QString asd; asd = parameter.attribute("extraInfo"); std::string qwe = asd.toStdString(); parameter.clear(); } return a.exec();}