Comparison of XML and JSON formats in Ajax

Source: Internet
Author: User
Tags pepr smarty template

Source: http://blog.csdn.net/heiyeshuwu/archive/2006/04/20
) '& D _, l2aa? /M1 {2q just finished a small project using Ajax. The entire small project uses javascr javaspt as the client, PHP as the server, XMLHttpRequest as the interaction tool, and XML as the data transmission format. After that, I will make a brief summary and briefly analyze the advantages and disadvantages of using XML as the transmission format.
+ Gje & X % C [XML] Java Chinese site Community Portal) L |: YF) r; AG
Advantages of using XML as the transmission format: xdizo (r y0n; W
1. unified format, compliant with standards
K "Y; y) _ 3 W $ y2. it is easy to remotely interact with other systems. Data Sharing is more convenient for Java Chinese site Community Portal y {'f1k (ya
Disadvantage: Java Chinese site Community Portal 4l-y9zm (EV [
1. xml file format is large and complex, and the transmission bandwidth is occupied. Java Chinese site Community Portal $ w ^: sy] Y, YW! ^
2. Both the server and client need to spend a lot of code to parse XML, regardless of the exception and complexity of the server and client code, and it is not easy to maintain the Java Chinese site Community Portal ry5kwob 'f6z
3. The method for parsing XML between different browsers on the client is inconsistent. You need to repeat a lot of code.
LTP * [} 4. It takes resources and time for the server and client to parse XML
| V'vb6we
R [JSON]
T & 'C; | $ ?! L in addition to the XML format, there are no other formats. There is a lightweight data exchange format called JSON (jsoncr into pT Object Notation) that can replace XML. java Chinese site Community Portal: wzmpqr "u
Advantages:
/~ 7b
G/jg8e1. The data format is simple, easy to read/write, and the format is compressed. The bandwidth is small. Java Chinese site Community Portal 5tj
YTT: sn3xg
2. It is easy to parse this language. The client-end javascr into pT can simply read JSON data through eval ().
.];? Z}, x6p3. supports multiple languages, including actionscr platinum PT, C, C #, ColdFusion, Java, javascr platinum PT, Perl, PHP, Python, Ruby, and other server-side languages, facilitate server-side parsing Java Chinese site Community Portal 'f) I _u.ty {
4. in the PHP world, there has been a PHP-JSON and a JSON-PHP that facilitates PHP Serialized programs to call directly. PHP server objects and arrays can directly generate JSON format to facilitate client access extraction. java Chinese site Community Portal | 3 [-CCU
In addition, the pear class of PHP has proposed support (http://pear.php.net/pepr/pepr-proposal-show.php? Id = 198) Java Chinese site Community Portal-l "d" V; P9} 3 {% I
5. JSON format can be used directly for server-side code, which greatly simplifies the development of server-side and client-side code, but the completed tasks remain unchanged and easy to maintain.
Kg
Pio "V (W disadvantages:
+? # ^ '] E7du) I * o # Q1. it is widely used and widely used without the XML format. It is not as universal as XML. Java Chinese site Community Portal
T9 {T: a7ekk
2. The JSON format is currently being promoted in Web Services and is still in the initial stage. k8dw. Y, a Java Chinese site Community Portal
K + R! ^ Z $ h; ^ m7y
PS: It is said that Google's Ajax is made using the JSON + template.
, D @ M
JC "m [JSON link] Java Chinese site Community Portal c6a; [+ q $ R; fiey
Official Website: http://www.json.org/java 中 Community Portal 7q1_d "a' B _ M & KP
Official Website: http://blog.patterns.cn/json/java 文 Community Portal &x3d! Uz9u, F! P2eu
Pear: html_ajax: http://pear.php.net/package/HTML_AJAX (quite mature Ajax framework, using JSON for data transmission, including rich client and server)
2g6t # A * L & rn + awe} services_json: http://pear.php.net/pepr/pepr-proposal-show.php? Id = 198
1fh R * w/7f {xldphp JSON Extension: http://www.javasre.net/projects/php-json/java 文 Community Portal: f? I ={ulqv
PHP and javascr platinum PT exchange data using JSON: http://www.flyinghail.net/archives/10
(U3A
N3b % {; m lajax using JSON: http://www.x2blog.cn/lulei/4101.htmljava 中 Community Portal (LW, ns0000n}
Comparison Between XML and JSON: http://blog.hexun.com/dulao5/912477_d.htmljava 文 Community Portal-e) | ya % na "da
Enable service_json to support Chinese characters: Required |
[Mature client framework]
C) W/, xmho (bxajax: http://xajax.sourceforge.net (currently widely used in China, combined with smarty template) Java Chinese site Community Portal "K
B
CPA u
@
Sajax: http://www.modernmethod.com/sajax/ (more complex frameworks, more languages supported) Java Chinese site Community Portal 7mi (CY ^ % d' [6ol
Ajax framework Summary: http://www.huihoo.com/web/ajax/ajax-frameworks.html

Tag:
Ajax
Ajax
Ajax
XML
XML
Format
Advantages and disadvantages
JSON

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.