Solved Editing XML file from Qt
-
Can anyone tell how can I edit an XML file from my Qt C++ code?
-
You can use the (deprecated) QtXml module, or the StAX API, directly in Qt core
IIRC. -
-
@VJain85
Note that I have used this QtXML module for some work, and it was fine. I think it is deprecated because nobody wants to maintain it, and it might have some oddities, rather than because it does not work or goes wrong. -
can we do this using SAX handler?
-
@VJain85
What do you mean by SAX handler ?The QXmlStreamReader is a SAX interface.
-
@VJain85
If you want to do your processing via theQXmlStreamReader/Writer
SAX-type parser that is fine. Note however that means you will not be editing the XML "in place"/"in memory", instead you will be reading the file incrementally and outputting the edited XML to a new file as you go along.