The Good: QXmlSimpleReader or QXmlQuery can be used to parse xml results in Qt. With QXmlSimpleReader (which is very low-level), one should write their own routine for every different xml structures – which is boring and not effective interms of code maintainance. Whereas QXmlQuery is a convenient way to parse xml structures from different sources using XQuery statements – it directly returns the result and queries are text statements, hence need not be shipped within code.
The Bad: QXmlSimpleReader is memory efficient ; QXmlQuery is not really memory efficient (Qt is working on these memory issues ).
And The Ugly: In Symbian if QXmlQuery is used in iteration (which is the majority case in most xml parsing scenarios) your app errors “Low memory, close some applications to continue”. Before getting into abusing Symbian one should understand how it runs an app. The app itself specifies how much stack and heap size it needs and Symbian tells “hey please execute respecting these limits, else I will be forced to terminate you!” , which sounds reasonable. So due to these memory conditions a piece of code running QXmlQuery under iteration will lead to low memory condition. This holds true even if you create QXmlQuery as a local variable or create an instance on demand – believe me.
So what is the way out? Well, nothing so far which blocks all memory issues until they are fixed in Qt. But we can make the app run better by making the QXmlQuery a member variable and allocate memory on heap, so that we reduce the chances of creating multiple QXmlQuery instances and hence control the amount of memory leaks by many folds.