Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Editing XML file from Qt

Editing XML file from Qt

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 5 Posters 1.3k Views 2 Watching
  • 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.
  • V Offline
    V Offline
    VJain85
    wrote on last edited by
    #1

    Can anyone tell how can I edit an XML file from my Qt C++ code?

    jsulmJ JonBJ 2 Replies Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by JohanSolo
      #2

      You can use the (deprecated) QtXml module, or the StAX API, directly in Qt core IIRC.

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      4
      • V VJain85

        Can anyone tell how can I edit an XML file from my Qt C++ code?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @VJain85 https://doc.qt.io/qt-5/qtxml-index.html

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        4
        • V VJain85

          Can anyone tell how can I edit an XML file from my Qt C++ code?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • V Offline
            V Offline
            VJain85
            wrote on last edited by
            #5

            can we do this using SAX handler?

            mrjjM JonBJ 2 Replies Last reply
            0
            • V VJain85

              can we do this using SAX handler?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @VJain85
              What do you mean by SAX handler ?

              The QXmlStreamReader is a SAX interface.

              1 Reply Last reply
              2
              • V VJain85

                can we do this using SAX handler?

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @VJain85
                If you want to do your processing via the QXmlStreamReader/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.

                1 Reply Last reply
                5

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved