XML与逗号分隔的文本文件 [英] XML vs comma delimited text files
问题描述
好吧,我已经读了几本关于XML的书,写了程序来吐出它,什么不是。但这里的问题。逗号分隔文件和XML文件都是可读的。但一般来说,逗号分隔文件在我的眼睛比XML文件容易得多;标签通常占用与数据相同的空间,即使不是更多的空间。这只是似乎掩盖了我正在阅读,格式可以采取一个页面包含相同的信息,你可以包含在逗号分隔文件中的单行文本。而逗号分隔的文件解析的复杂性显着降低。所以真正的问题是为什么XML?
Ok, I've read a couple books on XML and wrote programs to spit it out and what not. But here's the question. Both a comma delimited file and a XML file are "human readable." But in general, the comma delimited file is much easier on my eyes than a XML file; the tags typically take up as much if not more space than the data. This just seems to obscure what I'm reading and the format can take a page to contain the same information that you can contain on a single line of text in a comma delimited file. And a comma delimited file is significantly less complex to parse. So the real question is why XML? Just because all the cool kids are doing it?
推荐答案
这些不是唯一的两个选项,你也可以使用 JSON 或 YAML 比xml轻得多。
These aren't the only two options, you can also use JSON or YAML which are much lighter weight than xml.
一般来说,如果您有包含许多特殊字符的简单表格数据,CSV不是一个坏选择。对于结构化数据,请考虑使用其他3。
In general, if you have simple tabular data with out many special characters, CSV isn't a bad choice. For structured data, consider using one of the other 3.
这篇关于XML与逗号分隔的文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!