什么时候确定使用XML文件来保存的信息? [英] When is it OK to use an XML file to save information?
本文介绍了什么时候确定使用XML文件来保存的信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能有对使用XML来保存的信息什么原因呢?
What reason could there be for using an XML to save information?
推荐答案
可能有很多原因:像任何其他文件格式,它有优点和缺点:
There could be lots of reasons: like any other file format, it has pros and cons:
优点:
- 的.Net本身支持序列化的对象到XML,然后再返回反序列化它们。
- 它比二进制格式或JSON 更可读的和描述对人眼
- 这是很容易验证对一个架构,确保它在正确的格式。
- 可以加载和分析与其他工具。
- 这是很容易互换与其他平台/语言,不同的是本机.NET二进制序列化格式
- 在这可以转化的,你可以在它的XPath运行。
- .Net natively supports serializing your objects to xml, and deserializing them back again.
- It is more readable and descriptive to the human eye than a binary format or JSON
- It is easily validated against a schema to ensure it is in the correct format.
- It can be loaded and parsed with other tools.
- It is easily interchangeable with other platforms/languages, unlike the native .Net binary serialization format
- It can be transformed, and you can run xpath over it.
缺点:
- 这是比任何本地.NET二进制序列化格式更详细的,或JSON
- 在它不存储有关被反序列化到XML的类类型的信息,而本机二进制格式一样。
这篇关于什么时候确定使用XML文件来保存的信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文