XML vs. CSV

xiaoxiao2021-03-06  30

XML technology should be very familiar. After all, it is a very popular technology in recent years or a file format. Using XML we can use plain text files to store data with format, bring us It's very convenient. CSV technology is also a format using plain text, especially during the design of the report, has played a lot of role. If you are not very familiar with one or both technologies, let us look at the following example. For example, we want to store a salary situation of a department, then use two technologies, which should be like this. XML: Zhang 3 Development unit 2300 Lee 4 Development Department 2500 Wang 5 Sales 2000 CSV: Name, Department, GetSalary Zhang San, Development Department, 2300 Li Si, Development Department, 2500 Wang Wu, Sales Department, 2000 From above, we can clearly see two formats The advantages and disadvantages, in contrast, the XML file is less than the CSV file size, because the CSV file only needs to declare the meaning of each field at the file head, and the XML file needs to appear on each field. Where you need to declare the meaning of this field. In terms of meaning, XML accounts for a significant advantage, no matter how many fields, no matter how many records, whether we are watching the data in that location, everything is a place. In a project we have recently developed, we used the XML file to configure the profile and the transfer of data files, but the head is based on the size of the file, allowing us to store the data store with the CSV format. My personal opinion is like this. From the perspective, we really use the CSV file to pass data to make the file smaller, and save the time and cost of transmission, but from the long run? I don't think the CSV file can clearly express all the meaning. And when we view the file, for the XML file, even if there is no tool, we can understand it clearly, and will not have ambiguity, and for the CSV file, if you do not take the tool, we must It will be lost in a complicated data. Especially when there are many types of types of similar and similar fields, no one can guarantee that Zhang Guan Li Dai will not be read. Which file is better? I think it should be specific to the specific situation, but I still tend to XML files. Willing to listen to everyone!

转载请注明原文地址:https://www.9cbs.com/read-64986.html

New Post(0)