XML vs JS in Qt. What is more "native" for Qt?
-
-
@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.@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.
-
@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.
-
@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 ?
-
@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
-
@bogong
ok.
please test with 2GB json/xml before deciding.
It might not have acceptable performance for your use case. -
@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". :) -
@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". :) -
@mrjj I might be wrong in term "native". I mean what is historically more developed and used solution in Qt.
@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.