Data transfer between different programming languages, a need for a common data exchange format, it requires a simple and easy data storage, quickly read, and independently of the various programming languages. We tend to transfer text files, such as we all know csv (comma seperated values) format.
In the Internet, the transmission data structure often have many levels, not the matrix form (m × n) simple. Common are xml, json, yaml and so on. Which, yaml is "yaml is not markup language" recursive acronym, that the first letter of each word combinations just as the first word; and yaml also be interpreted as yet another markup language.
And the feeling of our nearest mainly xml and json, and is often encountered; yaml temporarily no contact. Therefore, this paper to be a little of both this summary.
(A) XML
Extensible Markup Language, Extensible Markup Language.
XML was originally designed to EDI (Electronic Data Interchange, EDI).
Long before the Web was born, SGML (Standard Generalized Markup Language, Standard Generalized Markup Language) was invented. However, it is too complicated, does not apply to the Web, the 1989 HTML (Hyper Text Markup Language, HTML) was born. And there are not describe HTML data, poor readability, long search time and other defects. In 1998, before the two as precursor, W3c (World Wide Web Consortium) released the XML 1.0 standard, marking the birth of XML.
The main grammar rules:
1, must have a declaration statement.
2, the case differently. For example, "<P>" and "<p>" tag are different.
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="osg.AndroidExample" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8"></uses-sdk> <uses-feature android:glEsVersion="0x00020000"/> <!-- OpenGL min requierements (2.0) --> <uses-permission android:name="android.permission.INTERNET"/> <application android:label="@string/app_name" android:icon="@drawable/osg"> <activity android:name=".osgViewer" android:label="@string/app_name" android:screenOrientation="landscape"> <!-- Force screen to landscape --> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
(B) JSON
JavaScript Object Notation, JavaScript Object Notation.
JSON is a lightweight data interchange format, easy to read and write, but also easy for machines to parse and generate, in 2001 began to promote.
The main grammar rules:
1. six basic symbols (longitudinal spaces are allowed): Array '[' and ']' object '{' and '}', named delimiter ':' Separator ','.
2. The value may be an object, an array, a number, or a string of three literal (false, null, true) one. The literal value in English must be lowercase.
{ "people": [{ "firstName": "Brett", "lastName": "McLaughlin" }, { "firstName": "Jason", "lastName": "Hunter" } ] }
It is recommended online XML and JSON parser, convenient data format conversion and viewing.
Parsing XML: https://c.runoob.com/front-end/710
Parse JSON: https://www.bejson.com/
References:
1. https://baike.baidu.com/item/%E5%8F%AF%E6%89%A9%E5%B1%95%E6%A0%87%E8%AE%B0%E8%AF%AD % E8% A8% 80/2885849? fromtitle = xml & fromid = 86251 & fr = aladdin (Baidu Encyclopedia XML)
2. https://baike.baidu.com/item/JSON (Baidu Encyclopedia JSON)