[Interest] QtXml deprecated, should I rewrite code that uses QDomDocument?

BRM bm_witness at yahoo.com
Fri Aug 9 17:17:42 CEST 2013

> From: Niels Dekker <mymailfromqt at xs4all.nl>

> To: "interest at qt-project.org" <interest at qt-project.org>
> Cc: 
> Sent: Friday, August 9, 2013 8:51 AM
> Subject: Re: [Interest] QtXml deprecated, should I rewrite code that uses QDomDocument?
> On 2013-08-09 14:33, Konstantin Tokarev wrote:
>>>  Are there other (technical) reasons for me to stop using QDomDocument?
>>  It's hell slow. Use pugixml [1] instead, it's MUCH faster (even if 
> compared with
>>  QXmlStreamReader), and it's API is similar to QDom (both are DOM 
> parsers).
>>  [1] http://pugixml.org
> Thanks, Konstantin, I very much appreciate your suggestion. However, the 
> XML files we're reading are rather small, so I'm not yet sure if it's 
> worth replacing QDomDocument, merely for performance reasons. Also I 
> have mixed feelings about getting an extra third party library 
> dependency. So anyone please let me know if there are still more reasons 
> to stop using QDomDocument  :-)

I'm of like-mind. I've got extensive XML protocol code that reads/writes many small XML messages. Performance hasn't been an issue; I moved from using libxml2 to QtXML because of the simplicity of using the QDomDocument classes and never noticed any issues (doing DOM parsing in both cases), character conversion for libxml2 was not fun, so Qt's native use of QString and literals were fantastic; I was also glad to get rid of the libxml2 dependency. Some of the messaging hits very hard for about 10-15 seconds when one program starts talking to another program at the start of a network connection; at one point we thought we might have had a performance issue (as the server side loop would lock up a thread for a short time) but it turned out to be something else entirely (another program trying to be real-time scheduled when it shouldn't have, resolving that by using a device driver for the critical code fixed the performance issue).

I'm not sure it would be a trivial thing to update from the QDomDocument support to QXmlStream* usage either.
May be a good conversion example (I didn't find one in a Google Search) would show the benefits?



More information about the Interest mailing list