Earlier versions of Qt had a number of XML parsers, each suited to different tasks and different styles of parsing. Each XML parser was used for different formats in older versions of Qt. Fortunately, in Qt 5, this has been streamlined; currently, you only need a single XML parser to parse XML data. The key XML parser to use in the latest Qt version is the QXmlStreamReader class (see https://doc.qt.io/qt-5/qxmlstreamreader.html for details). This class reads from a QIODevice subclass and reads XML tags one at a time, letting you switch on the type of tag the parser encounters. Thus, our parser looks something like this:
QXmlStreamReader xml; xml.setDevice(input); while (!xml.atEnd())
{ QXmlStreamReader::TokenType type = xml.readNext(); switch(type) { ... // do processing } } if (xml.hasError())
{ ... // do error handling...