|
|
Posted on 9/4/2018 10:56:29 AM
|
|
|

We may have seen .yml format in the spring configuration file, aren't the configuration files all .professional or .xml files? What the hell is .yml, today I will take you to find out.
YAML (Yet Another Markup Language) (pronounced /ˈjæməl/) A programming language based on Unicode that is easy to read and interact with scripting languages to express data sequences.
Adapt to the scenario
- Scripting Languages: Due to their simple implementation and low parsing costs, YAML is particularly suitable for use in scripting languages
- Serialization: YAML is a direct transfer from the host language data type, which is more suitable for serialization.
- Profile: Writing YAML is much faster than writing XML (without worrying about tags or quotes) and is more powerful than INI documentation. Due to compatibility issues, it is recommended not to use YAML for data flow between different languages.
Language advantages
- YAML is easy for people to read.
- YAML data is portable between programming languages.
- YAML matches the native data structures of the Agile language.
- YAML has a consistent model to support common tools.
- YAML supports single-pass processing.
- YAML is expressive and scalable.
- YAML is easy to implement and use.
YAML syntax
- Use space indentation to indicate hierarchy, indentation between different levels can use different number of spaces, but elements in the same layer must be aligned to the left, that is, the number of spaces in front is the same (you cannot use tab, the number of spaces corresponding to tabs in each system may be different, resulting in confusion in the hierarchy).
- '#' indicates comments, which can only be commented on a single line, from the beginning of # to the end of the line
- A dash and space after a dash indicates the list
- Use colons and spaces to indicate key-value pairs key: value
- Simple data (scalar data) can be enclosed without quotation marks, including string data. C-style escape characters are used in single or double quotes as string data, and C-style escape characters are used in single or double quotes
Sequence of Scalars Simple Data List
Mapping Scalars to Scalars Simple Data Key-Value Pairs and Annotations
Mapping Scalars to Sequences Simple Data List Key-Value Pairs
Sequence of Mappings key-value pair list
YAML also supports flow types, enclosing lists with parentheses and separating elements with commas; Parentheses indicate key-value pairs with braces and commas separate elements. A list of Sequences lists
Mapping of Mappings key-value pairs
YAML Official Website:http://www.yaml.org YAML official documentation:http://www.yaml.org/spec/1.2/spec.html
|
Previous:Write Oracle stored procedures, ask for helpNext:Detailed explanation of how to use Nginx variables
|