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. Parsing xml file [solved]
Forum Update on Monday, May 27th 2025

Parsing xml file [solved]

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 1.9k Views
  • 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.
  • A Offline
    A Offline
    abich
    wrote on last edited by
    #1

    i want to load an xml file which have a name choose by the user. How can I do it??

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Qt offers 3 ways to parse Xml files:

      • "QXmlStreamReader":http://qt-project.org/doc/qt-5/QXmlStreamReader.html - part of QtCore: is very fast, but not so easy to implement
      • "QDom":http://qt-project.org/doc/qt-5/qdomdocument.html - slower, more memory-heavy, but easy to implement
      • QXmlReader/ "QXmlSimpleReader":http://qt-project.org/doc/qt-5/qxmlsimplereader.html

      (Z(:^

      1 Reply Last reply
      0
      • IamSumitI Offline
        IamSumitI Offline
        IamSumit
        wrote on last edited by
        #3

        hii ablch,
        and For choosing a file use
        QString filename = QFileDialog::getOpenFileName();

        Be Cute

        1 Reply Last reply
        0
        • A Offline
          A Offline
          abich
          wrote on last edited by
          #4

          I tried to use QFileDialog but i have an error when running the program "no gui is being used"

          1 Reply Last reply
          0
          • IamSumitI Offline
            IamSumitI Offline
            IamSumit
            wrote on last edited by
            #5

            have you added QT +=gui in your .pro file ?

            Be Cute

            1 Reply Last reply
            0
            • IamSumitI Offline
              IamSumitI Offline
              IamSumit
              wrote on last edited by
              #6

              and also check whether you are using QCoreApplication or QApplication.
              in your main function.
              "no gui being used " error occurs when you use any gui in QCoreApplication.
              so replace QCoreApllication to QApplication.

              hope it'll help

              Be Cute

              1 Reply Last reply
              0
              • A Offline
                A Offline
                abich
                wrote on last edited by
                #7

                thanks for your help! it works

                1 Reply Last reply
                0
                • IamSumitI Offline
                  IamSumitI Offline
                  IamSumit
                  wrote on last edited by
                  #8

                  it's nice that your problem is solved Please prepend [Solved] in your title so other members can see it as solved.
                  thanks

                  Be Cute

                  1 Reply Last reply
                  0

                  • Login

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