Which is best for parsing in Qt???

    1. QXmlStreanreader
    2. Qt dom parser
    3. Qt sax parser

    which is fastest and occupy less memory.**
    if there any other please provide????

  • What are exactly your requirements? Sounds like a question from somebody who has never used a XML parser.

  • 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.

  • It really all depends on your use case, and you are not telling us about that. Personally, I use the QXmlStream* API most nowadays.

  • 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/

  • thanks all of you, my aim of this question is knowledge and some discussion. i know its not that important topic but it would be helpful for fresh developers.

  • i have also agreed that qxmlstream* api is faster and occupy less memory. it is helpful in mobile devices where less memory is avilable

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.