the question is now a political one, and there will be opposition. I can only say the personal view, that is: If you talk about data transmission, XML relative to JSON has no advantage, from the beginning.
Many of today's XML supporters may have forgotten that XML was not designed for network transmission at first, but rather instead of HTML. That's why it's so stressed. Structured (easy to parse relative to the clutter structure of HTML 4) and format built-in encoded information (facilitates cross-country data exchange). But after the birth of XML in this area has been tepid, but also in XHTML a little achievements. Other applications, such as Mathxml, XSLT and so on, are not widely used. Until later, RSS and EPub became popular, and XML came back to some of the original directions.
the specific history of XML's popularity has been hard to verify, only known by the Java Enterprise application and the DOM (Document Object model) standard of the East wind. XML in Java enterprise applications is often used for the following purposes: Configuration file and transport format (SOAP, Simple Object Transfer Protocol). With the increase of Java application, the application of XML is also widening, but the whole is not out of these two aspects.
if just as a key-value pair type configuration file format, XML is not good, its problem is that it contains too much for the real data transmission useless things, in the computer World terminology, is Payload not high enough. such as the presence of angle brackets, such as hierarchical structure of the label, such as Dtd/schema. Where is the most basic problem? Bandwidth. Each of these bytes will be a burden on the transmission bandwidth. The only benefit is that DOM parsers are almost everywhere, but this advantage is no longer relative to JSON.
on the whole, I am happy to see JSON instead of XML. Not because the XML is lost, but the entire program development world can finally take a rational look at the hands of the tool. XML has its own uses, such as EPub, such as SVG. Of course it can still be used for data transmission, such as my blog page. But why should we not be entangled in the data transmission of a single use it. ------------the holy War between XML and JSON may become another jihad since Vim/emacs jihad, Cli/gui Jihad and so on, and all jihad will probably not result, because each side has its own truth, and no one will obey.
in my opinion, XML is more suitable for data definition and data storage. Its representation of the data makes the data out of the context of your program still meaningful and can be interpreted. So XML is suitable as a configuration file, as well as data storage, disk file format, and so on.
JSON is more suitable for data transfer. For the transmission, the two sides must follow the negotiated agreement, so the expression of JSON to the data does not need to be in the transmission of the two sides still have the meaning of interpretation, as long as the transmission of both sides can read. So JSON is better suited as a communication protocol for both parties to the data transfer.
If the use is confined to the field of data transmission, then XML has no advantage. The only possible advantage might be that if your data was originally organized and defined using XML, it would be more convenient to use the XML transfer directly.
the emphasis on data transfer and storage is different, even if UNICODE is two different encodings for transport and storage, there is no need to be persistent in using a format that is more suitable for data storage.
In what ways does XML have an advantage over JSON in terms of data transfer, and in which areas is more appropriate?