Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved How to write specific tag in existing XML using QXmlStreamWriter ?

    General and Desktop
    2
    2
    24
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MECoder last edited by MECoder

      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?
      Thx

      The 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>
      
      
      JonB 1 Reply Last reply Reply Quote 0
      • JonB
        JonB @MECoder last edited by JonB

        @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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post