<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>[url=http://www.qqread.com/z/web/ajax/z.html]<span style="font-family: Times New Roman; font-size: 18px;">Ajax</span>[/url]<span style="font-family: Times New Roman; font-size: 18px;">这个特定的领域,未来的发展一定是XML让位于JSON。到时Ajax应该变成Ajaj
(Asynchronous</span>[url=http://www.qqread.com/keywords/%20.html]<span style="font-family: Times New Roman; font-size: 18px;">JavaScript</span>[/url]<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>
<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>[url=http://www.qqread.com/z/web/ajax/z.html]<span style="font-family: Times New Roman; font-size: 18px;">Ajax</span>[/url]<span style="font-family: Times New Roman; font-size: 18px;">这个特定的领域,未来的发展一定是XML让位于JSON。到时Ajax应该变成Ajaj
(Asynchronous</span>[url=http://www.qqread.com/keywords/%20.html]<span style="font-family: Times New Roman; font-size: 18px;">JavaScript</span>[/url]<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>