Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. XML vs JS in Qt. What is more "native" for Qt?
Qt 6.12 LTS is out! See what's new in the release blog

XML vs JS in Qt. What is more "native" for Qt?

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 4 Posters 2.7k Views 4 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.
  • JKSHJ JKSH

    Qt supports CBOR too: https://doc.qt.io/qt-5/qtcborcommon.html

    CBOR is like JSON but more flexible (because it supports more types) and faster (because it transmits binary data instead of human-readable text)

    B Offline
    B Offline
    bogong
    wrote on last edited by bogong
    #8

    @jksh Is there any example of using CBOR? Be honest - I've never heard about it ... And the same questions about Long Term Storing, how about it?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bogong
      wrote on last edited by
      #9

      @mrjj @JKSH and others ... Thanks for replies, but never the less ... What about topic of this thread? What is more native JSON and XML?

      mrjjM 1 Reply Last reply
      0
      • B bogong

        @mrjj @JKSH and others ... Thanks for replies, but never the less ... What about topic of this thread? What is more native JSON and XML?

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

        @bogong
        None of them is more native than the other.
        Both is just classes using Qt types.

        B 1 Reply Last reply
        0
        • mrjjM mrjj

          @bogong
          None of them is more native than the other.
          Both is just classes using Qt types.

          B Offline
          B Offline
          bogong
          wrote on last edited by
          #11

          @mrjj Thx

          mrjjM 1 Reply Last reply
          0
          • B bogong

            @mrjj Thx

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

            @bogong
            Just as info.
            we tested XML / JSON for our project.
            In most cases, xml is more verbose and we found json
            generally nicer to work with.
            Its easy to handwrite some json.
            xml, not so much.

            B 1 Reply Last reply
            2
            • mrjjM mrjj

              @bogong
              Just as info.
              we tested XML / JSON for our project.
              In most cases, xml is more verbose and we found json
              generally nicer to work with.
              Its easy to handwrite some json.
              xml, not so much.

              B Offline
              B Offline
              bogong
              wrote on last edited by bogong
              #13

              @mrjj For hand-writing it's mater of experience only. I've started to use XML more than 10 years ago and beside all of it huge experience in HTML/CSS. For me doesn't matter at all which is better for handwriting. BTW - Microsoft *.docx format it's ZIPed XML. And a lot of applications using XML for data exchange. But it's only historically, XML appeared earlier than JSON especially in enterprise applications.

              mrjjM 1 Reply Last reply
              0
              • B bogong

                @mrjj For hand-writing it's mater of experience only. I've started to use XML more than 10 years ago and beside all of it huge experience in HTML/CSS. For me doesn't matter at all which is better for handwriting. BTW - Microsoft *.docx format it's ZIPed XML. And a lot of applications using XML for data exchange. But it's only historically, XML appeared earlier than JSON especially in enterprise applications.

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

                @bogong
                ok. also a good xml editor helps with all the end tags.

                Btw i forgot to ask

                How much data do you plan to save ?

                B 1 Reply Last reply
                0
                • mrjjM mrjj

                  @bogong
                  ok. also a good xml editor helps with all the end tags.

                  Btw i forgot to ask

                  How much data do you plan to save ?

                  B Offline
                  B Offline
                  bogong
                  wrote on last edited by
                  #15

                  @mrjj said in XML vs JS in Qt. What is more "native" for Qt?:

                  How much data do you plan to save ?

                  It's unpredictable and depend on situation. Might be 2 bite might be + 2Gb

                  mrjjM 1 Reply Last reply
                  0
                  • B bogong

                    @mrjj said in XML vs JS in Qt. What is more "native" for Qt?:

                    How much data do you plan to save ?

                    It's unpredictable and depend on situation. Might be 2 bite might be + 2Gb

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

                    @bogong
                    ok.
                    please test with 2GB json/xml before deciding.
                    It might not have acceptable performance for your use case.

                    B 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @bogong
                      ok.
                      please test with 2GB json/xml before deciding.
                      It might not have acceptable performance for your use case.

                      B Offline
                      B Offline
                      bogong
                      wrote on last edited by
                      #17

                      @mrjj sure, I know it - this is the main reason to question about "more native".

                      mrjjM 1 Reply Last reply
                      0
                      • B bogong

                        @mrjj sure, I know it - this is the main reason to question about "more native".

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

                        @bogong
                        Well both will be slow with a 2GB file.
                        However, XML has also has
                        https://doc.qt.io/qt-5/qxmlsimplereader.html#details
                        which is a SAX interface that reduces the memory requirements
                        compared to the XML Dom parser / json that will fully
                        populate an internal "tree" of the file.

                        Also, Qt is a framework. Not a language so all its classes are
                        the same level of "native". :)

                        B 1 Reply Last reply
                        1
                        • mrjjM mrjj

                          @bogong
                          Well both will be slow with a 2GB file.
                          However, XML has also has
                          https://doc.qt.io/qt-5/qxmlsimplereader.html#details
                          which is a SAX interface that reduces the memory requirements
                          compared to the XML Dom parser / json that will fully
                          populate an internal "tree" of the file.

                          Also, Qt is a framework. Not a language so all its classes are
                          the same level of "native". :)

                          B Offline
                          B Offline
                          bogong
                          wrote on last edited by
                          #19

                          @mrjj I might be wrong in term "native". I mean what is historically more developed and used solution in Qt.

                          mrjjM 1 Reply Last reply
                          0
                          • B bogong

                            @mrjj I might be wrong in term "native". I mean what is historically more developed and used solution in Qt.

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

                            @bogong
                            I think they are both equal in that regards.
                            The XML is older (i think) then JSON but could not find the exact info.
                            Internally Qt uses binary / DataStreams.

                            So it seems to save to choose between json/xml based on performance and
                            memory use concerns + your personal experience with xml.

                            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
                            • Unsolved