常见的配置文件和数据交换格式
阅读量
0
阅读人次
0
从本质上来说,这是程序中数据结构的序列化和反序列化方法。
只不过作为配置文件,我们希望序列化的内容能够清晰直观富有层次感,用户可以不凭借其它工具,只用普通的文本编辑器打开就能知道有哪些内容。
而作为数据交换,常见于网络应用中,可能希望序列化的数据能够尽可能的小以节省带宽,或者也可能希望序列化的内容能够比较直观查看而便于调试开发。
当然,也有些特殊情况,比如配置文件使用二进制形式序列保存,数据交换使用 xml 格式。这里不做特殊讨论,重要的是根据经验结合实际情况使用这些工具。