Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. [Moved] CSV File to XML File

[Moved] CSV File to XML File

Scheduled Pinned Locked Moved Brainstorm
9 Posts 6 Posters 7.0k 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.
  • I Offline
    I Offline
    Indrajeet
    wrote on 12 Jul 2011, 09:32 last edited by
    #1

    Hi All

    Is there any way by which i can convert CSV file to XML file.

    or Can i export contents of QTableWidget to XML File

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on 12 Jul 2011, 09:42 last edited by
      #2

      Nope, you should write your own custom converter.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dialingo
        wrote on 12 Jul 2011, 11:54 last edited by
        #3

        Don't fear. Writing XML with Qt is very simple.
        The documentation of QDomDocument contains template code for you.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jensen82
          wrote on 12 Jul 2011, 12:13 last edited by
          #4

          To read content of a CSV-File you could split the content by using QRegExp. Use ; as splitter.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on 12 Jul 2011, 14:39 last edited by
            #5

            [quote author="jensen82" date="1310472822"]To read content of a CSV-File you could split the content by using QRegExp. Use ; as splitter.[/quote]
            No, don' t do that. What happens if the contents between " happens to contain a semicolon? Then you are in big trouble. Use a decent CSV parser instead, it is not as trivial as just splitting lines on a separator.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dialingo
              wrote on 12 Jul 2011, 15:29 last edited by
              #6

              There is no need to write a CSV parser. There are millions available.
              A Qt CSV parser:
              http://sourceforge.net/projects/qcsv/

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jensen82
                wrote on 12 Jul 2011, 20:16 last edited by
                #7

                I'm using boost::spirit for text-parsing. Very fast!

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DenisKormalev
                  wrote on 12 Jul 2011, 20:34 last edited by
                  #8

                  Hm, Spirit is overhead for csv parsing I think.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on 12 Jul 2011, 22:07 last edited by
                    #9

                    I moved this thread to the brainstorm forum, as it's only marginally Qt related.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0

                    1/9

                    12 Jul 2011, 09:32

                    • Login

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