在 Android、XML 或 JSON 的解析性能方面哪个更好? [英] which is better in terms of parsing performance in Android, XML or JSON?

查看:22
本文介绍了在 Android、XML 或 JSON 的解析性能方面哪个更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是安卓开发新手

我的 Android 应用程序应该使用什么,XML 或 JSON?

What should I use for my Android application, XML or JSON?

在解析性能方面哪个更好?

Which is better in terms of parsing performance?

如果有任何示例代码,我将不胜感激.

I would appreciate any sample code.

推荐答案

JSON 比 XML 更好

JSON is best compare to XML

XML 不太适合数据交换

XML is not well suited to data-interchange

简单

XML 比 SGML 简单,但 JSON 比 XML 简单得多.JSON 的语法要小得多,并且可以更直接地映射到现代编程语言中使用的数据结构.

XML is simpler than SGML, but JSON is much simpler than XML. JSON has a much smaller grammar and maps more directly onto the data structures used in modern programming languages.

可扩展性

JSON 不可扩展,因为它不需要.JSON 不是文档标记语言,因此不需要定义新的标签或属性来表示其中的数据.

JSON is not extensible because it does not need to be. JSON is not a document markup language, so it is not necessary to define new tags or attributes to represent data in it.

互操作性

JSON 具有与 XML 相同的互操作性潜力.

JSON has the same interoperability potential as XML.

开放性

JSON 至少与 XML 一样开放,也许更开放,因为它不在企业/政治标准化斗争的中心.

JSON is at least as open as XML, perhaps more so because it is not in the center of corporate/political standardization struggles.

重量:由于 JSON 语法需要较少的字符,因此它比 XML 更轻巧.

Weight: Since JSON syntax requires fewer characters, it is lighter on the wire than XML.

不过还是看需求吧!

这篇关于在 Android、XML 或 JSON 的解析性能方面哪个更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆