XML (extensible Markup Language)
Definition: An extensible, markup language
XML has a wealth of coding tools, such as dom4j, Jdom, and so on.
JSON (JavaScript Object Notation)
Definition: A lightweight format for data interchange
JSON also has the tools provided by json.org, but JSON is much easier to encode than XML, and even if you can write JSON code without tools, it's not easy to write XML.
Comparison of the two
Parsing method
XML currently has two ways of parsing: Dom and sax.
DOM: The XML as a whole as an object, parsing the time to read the entire XML into memory.
Sax:sax does not need to read the entire document can be parsed out of the content of processing, is a step-by-phase analysis method. The program can also terminate parsing at any time. In this way, a large document can be gradually and 1.1 points, so sax is suitable for large-scale parsing. At this point, JSON is not available at this time.
JSON parsing is much more convenient, he is key/value; can be seen as an array.
Encoding: XML easy to read and hard to write JSON easy to write difficult to read
Java network communication--xml and JSON