Selection of XML and JSON

Source: Internet
Author: User

Xml&json war, roughly can be divided into two opposing camps, one side think that JSON is strong enough to replace XML, the other side that the JSON is funny and ugly, there is no possibility of competing with the XML. In order to avoid "pull the hatred" (I am not MT), I do not json&xml who strong who weak stance, just analysis of xml&json typical application scenarios.

1. In case of human-machine interaction, we recommend using XML to provide the configuration for "machine". "Person" here means a lack of programming experience operator or careless coder, "machine" refers to software system. Why choose XML instead of JSON? The main reason is the XML beauty bar. XML Beauty is a historical reason, in Java, for example, Tomcat inside the web.xml,struct inside of the classic action, no one is not configured with XML; programming is about preconceived, he first appeared, is the standard, on the United States! JSON is really a little ugly, countless curly braces to make you crack heart! The second reason is that the XML constraint comparison specification is mature, the benefit of the specification is to greatly reduce the cost of configuring "Make an XML constraint", you just need to learn DTD or schema can easily "make an XML constraint", but for most individuals or companies, Making a JSON constraint is much more expensive than writing some DTD or schema.

2. In Java, use XML as much as possible. Java and XML have a sense of collusion, because there are too many XML-related tools such as XML parsers in Java, really, too many.

3, XML can implement some simple stand-alone database.

4, in the network transmission, try to use JSON. Why is it? Because JSON is lighter, the form is simpler. Lightweight means it can help you save more traffic, and simplicity means it's easier to achieve cross-platform and scaling.

5, node, or Web script to use JSON. This, with an explanation ...

6, JSON can be conveniently stored in some Key-value database.

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.