Ajax 应该变成 Ajaj (关于JSON 与 XML 的比较)_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > Ajax 应该变成 Ajaj (关于JSON 与 XML 的比较)

Ajax 应该变成 Ajaj (关于JSON 与 XML 的比较)

 2011/12/28 17:55:36  haouziwefe  http://haouziwefe.iteye.com  我要评论(0)
  • 摘要:<spanstyle="font-family:TimesNewRoman;font-size:18px;">1、可读性</span><spanstyle="font-family:TimesNewRoman;font-size:18px;">JSON和XML的可读性可谓不相上下,一边是建议的语法,一边是规范的标签形式,很难分出胜负。</span><spanstyle="font-family:TimesNewRoman;font-size
  • 标签:Ajax JSON XML JS

   
<span style="font-family: Times New Roman; font-size: 18px;">1、可读性 </span>

<span style="font-family: Times New Roman; font-size: 18px;"> JSON和XML的可读性可谓不相上下,一边是建议的语法,一边是规范的标签形式,很难分出胜负。</span>

<span style="font-family: Times New Roman; font-size: 18px;">2、可扩展性</span>

<span style="font-family: Times New Roman; font-size: 18px;">XML天生有很好的扩展性,JSON当然也有,没有什么是XML能扩展,JSON不能的。<br>
3、编码难度</span>

<span style="font-family: Times New Roman; font-size: 18px;"> XML有丰富的编码工具,比如Dom4j、JDom等,JSON也有json.org提供的工具,但是JSON的编码明显比XML容易许多,即使不借助工具也能写出JSON的代码,可是要写好XML就不太容易了。</span>

<span style="font-family: Times New Roman; font-size: 18px;">4、解码难度</span>

<span style="font-family: Times New Roman; font-size: 18px;">XML的解析得考虑子节点父节点,让人头昏眼花,而JSON的解析难度几乎为0。这一点XML输的真是没话说。</span>

<span style="font-family: Times New Roman; font-size: 18px;">5、流行度</span>

<span style="font-family: Times New Roman; font-size: 18px;"> XML已经被业界广泛的使用,而JSON才刚刚开始,但是在</span><span style="font-family: Times New Roman; font-size: 18px;">Ajax</span><span style="font-family: Times New Roman; font-size: 18px;">这个特定的领域,未来的发展一定是XML让位于JSON。到时Ajax应该变成Ajaj
(Asynchronous</span><span style="font-family: Times New Roman; font-size: 18px;">JavaScript</span><span style="font-family: Times New Roman; font-size: 18px;"> and JSON)了。</span>

<span style="font-family: Times New Roman; font-size: 18px;">6、XML与JSON的写法</span>

<span style="font-family: Times New Roman; font-size: 18px;">XML写法:</span>

<span style="font-family: Times New Roman; font-size: 18px;"><contact></span>

<span style="font-family: Times New Roman; font-size: 18px;"> <friend></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <name>Michael</name></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <email>17bity@gmail.com</email></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <homepage>http://www.jialing.net</homepage></span>

<span style="font-family: Times New Roman; font-size: 18px;"> </friend></span>

<span style="font-family: Times New Roman; font-size: 18px;"> <friend></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <name>John</name></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <email>john@gmail.com</email></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <homepage>http://www.john.com</homepage></span>

<span style="font-family: Times New Roman; font-size: 18px;"> </friend></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <friend></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <name>Peggy</name></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <email>peggy@gmail.com</email></span>

<span style="font-family: Times New Roman; font-size: 18px;">  <homepage>http://www.peggy.com</homepage></span>

<span style="font-family: Times New Roman; font-size: 18px;"> </friend></span>

<span style="font-family: Times New Roman; font-size: 18px;"></contact></span>

<span style="font-family: Times New Roman; font-size: 18px;">JSON写法:[</span>

<span style="font-family: Times New Roman; font-size: 18px;">{</span>

<span style="font-family: Times New Roman; font-size: 18px;"> name:"Michael",</span>

<span style="font-family: Times New Roman; font-size: 18px;"> email:"17bity@gmail.com",</span>

<span style="font-family: Times New Roman; font-size: 18px;"> homepage:"http://www.jialing.net"</span>

<span style="font-family: Times New Roman; font-size: 18px;">},</span>

<span style="font-family: Times New Roman; font-size: 18px;">{</span>

<span style="font-family: Times New Roman; font-size: 18px;"> name:"John",</span>

<span style="font-family: Times New Roman; font-size: 18px;"> email:"john@gmail.com",</span>

<span style="font-family: Times New Roman; font-size: 18px;"> homepage:"http://www.jobn.com"</span>

<span style="font-family: Times New Roman; font-size: 18px;">},</span>

<span style="font-family: Times New Roman; font-size: 18px;">{</span>

<span style="font-family: Times New Roman; font-size: 18px;"> name:"Peggy",</span>

<span style="font-family: Times New Roman; font-size: 18px;"> email:"peggy@gmail.com",</span>

<span style="font-family: Times New Roman; font-size: 18px;"> homepage:"http://www.peggy.com"</span>

<span style="font-family: Times New Roman; font-size: 18px;">}</span>

<span style="font-family: Times New Roman; font-size: 18px;">]</span>

<span style="font-family: Times New Roman; font-size: 18px;"></span>

<span style="font-family: Times New Roman; font-size: 18px;"></span>

<span style="font-family: Times New Roman; font-size: 18px;"></span>

<span style="font-family: Times New Roman; font-size: 18px;"> </span>

<span style="font-family: Times New Roman; font-size: 18px;"></span>

<span style="font-family: Times New Roman; font-size: 18px;"></span>

 
发表评论
用户名: 匿名