I read somewhere XML is document oriented and JSON is object oriented. What does that mean?
问题:
回答1:
XML was designed, as SGML before it, to represent documents. Later, it became adopted in web-based remote procedure calls and configuration files as a data rather than document oriented format.
JSON was designed to represent JavaScript data. It has flourished in the data-oriented areas into which XML had previously expanded and is a better fit there.
XML has retained its original advantage as a document format. It has numerous schema definition languages (XSD, Relax NG, Schematron, and DTD) developed across many sectors, powerful selection (XPath) and transformation (XSLT) tools, and it supports mixed markup needed in document representation.
JSON has ridden the JavaScript wave and is now used for data exchange and persistence across many other languages and platforms. It is lighter weight and closer in syntactic form to programming data structures.
They both have their place in modern systems and application development.