Which is best for parsing in Qt???
-
Sax is the fastest and uses less memory.
Disadvantage of sax-parsers: callback-based. So, you aren't able to "walk through" the DOM several times.The DOM-model uses more memory but more comfortable...
A fourth framework you're not mentioned: libxml2 (not Qt, but C++)
-
I really like the QXmlStream* APIs. They still use much less memory than QDOM since they are incremental like SAX2 but do not require a load of callbacks to be registered.
It is still easy with QXmlStreamReader to recurse into specialised functions for each sub-section of your XML document.
-
Take care: some important entities aren't supported by the Qt XML parsers.
See: http://bugreports.qt.nokia.com/browse/QTBUG-6610
(see comment "No, we don't support those entities at all")If you need a really high-end xml parser with entities and DTD-support, than libxml2 is the best (and the most complicated) solution.
-
Also, note that the QtXml module is considered done and that QXmlStreamReader and QXmlStreamWriter are recommended to use instead. See the following "blog":http://labs.qt.nokia.com/2011/05/12/qt-modules-maturity-level-the-list/