Now that we know how parsing works in XML, we can see what the implementation of the core of WorkerThread looks like, as follows:
- The following code shows the implementation of WorkerThread:
WorkerThread::WorkerThread(QObject* owner){ this->setParent(owner); mNetManager = new QNetworkAccessManager(this); connect(mNetManager, &QNetworkAccessManager::finished, this, &WorkerThread::handleNetFinished);}void WorkerThread::run() { QXmlStreamReader xml; QXmlStreamReader::TokenType type; QString fieldName; QString value; QString tag; bool successful = false; bool gotValue = false; QMap<QString, QString> result; xml.setDevice(mReply);
- Then, we continue to write our code, and start parsing the XML data by looping through ...