PDA

View Full Version : Editing xml files



xdn
10th December 2014, 09:38
Hi,

I want to edit an xml file in a Qt application and am wondering what would be the best way to do this.
In the past I've usually used other libraries for this (tinyxml for example) but would like to take the opportunity now to learn more about Qts xml support.

Some considerations:
Seaching for Qt+xml leads me here: http://qt-project.org/doc/qt-5/qtxml-index.html .
The DOM classes included in that module seem to be pretty much what I'm looking for (my xml files are not large).
However, the module includes the hint that it is no longer maintained and the QXmlStreamReader/Writer classes should be used.
I am not familiar with those classes but the approach there seems similar to SAX.
If so, I would assume these classes may be able to parse/generate XML nicely but editing should be quite difficult (due to the event driven approach, i.e. no DOM tree).
Which method would you recommend in my case for editing xml files (and for what reason)?
Is there a third way to do this in Qt which I may have missed?

Best,
xdn

anda_skoa
10th December 2014, 09:58
If you are accustomed to working with a DOM tree, use the DOM tree.

Cheers,
_