What are the differences or benefits of using a binary or XML with a TClientDataSet?

Is there any difference or benefits using a binary or XML file with a TClientDataSet.

+4
source share
5 answers

Binary files will be smaller and faster.

XML will be more portable and user friendly.

+8
source

The binary will be slightly smaller.

The main advantage of the XML format is that you can pass it through HTTP protocols.

+1
source

The binary is smaller and faster, but only available for TClientDataSets.

XML is larger and slower (both are not so bad, i.e. not an order of magnitude larger or slower). XML is human readable (not recommended at all, but doable) and software. Therefore, it is more portable (as Nick wrote).

TClientDataSets can load and save their own XML style, or you can use the XML Mapper Delphi tool to read and write any XML data.

XSLT can, for example, be used to convert these XML files to any text, including other XML, HTML, CSV, fixed columns, etc.

In contrast to what Tim indicates, both binary and XML can be transmitted via HTTP and HTTPS. However, XML submissions are often evaluated, as they are easier to track.

+1
source

Without verification: I think the binary format will be much faster when reading and writing. However, you better do your own tests.

Another advantage of a binary file may be that it cannot be easily edited, which prevents people from deleting data outside the application.

0
source

When using Delphi 2009, we noticed that if the file has the .XML extension, it will not be saved in binary format over the existing dfXMLUTF8 format, even with LoadFromFile, SaveToFile. Changing the file extension to another (for example, DAT) allows you to save the file in dfBinary. Our experience is that a binary file, in addition to being somewhat more difficult to manipulate with the end user (plus!), Is approximately 50% smaller than a dfXMLUTF8 file.

0
source

All Articles