How to write specific tag in existing XML using QXmlStreamWriter ?
-
Hello,
i have an existing XML file that i parse with QXmlStreamReader, calculate somre results and later i want to write these results to the existing XML directly into the tag
<Results>
</Results>
My problem is to finde this tag within the XML file with the QXmlStreamWriter class. Sure, i can find the StartElement <Results> with QXmlStreamReader, but how does this
help. How can i write to a specific tag in an existing XML file without writing the complete XML fiel again?
Can anyone give me a hint?
ThxThe XML looks like this and between the tags Data and Points a lot of other tags.
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <Calibration version="0.5"> <Sensor sn="" type=""> <BinFile></BinFile> <Data> </Data> <Points> </Points> <Results> </Results> </Sensor> </Calibration>
-
@MECoder said in How to write specific tag in existing XML using QXmlStreamWriter ?:
How can i write to a specific tag in an existing XML file without writing the complete XML fiel again?
You can't update an actual XML text file (just like you can't for any text file). You have to rewrite the whole new XML over the whole file.