Recently processed some configuration files, encountered in the YAML format of the file, because no previous contact with this format file, for XML is more familiar. So what is YAML? What are the advantages and disadvantages of it compared to XML? What is the situation with YAML
Serialization in. NET is usually in binary or xml format. After ajax emerged, the JSON format is also used, which is rare compared with YAML.
BinaryCannot be directly read. It must be decoded at the binary level;The format is defined by the vendor. When the objects to be represented by a specific application are complex, the format is also complex, such as the office file format;We usually need to fully co
What is YAML? What are its advantages and disadvantages over XML? Under what circumstances will YAML be used? How to use YAML? Here is a simple summary. Recently, I have processed some configuration files and encountered files in YAML format. because I have never touched fil
This article mainly introduces the PHP configuration file reading class, which can read configuration files such as ini, yaml, and xml. it has some reference value, for more information about how to read configuration files from PHP, see the following example. Share it with you for your reference. The details are as follows:
/*** For PHP configuration, such as the configuration file * config. php
This is a creation in
Article, where the information may have evolved or changed.
in order to publish our well-written server to the server, we have to build our code to package, so if you want to modify some code later, you need to re-compile the code to package and upload to the server.Obviously, this is too cumbersome ... As a result, it is common practice to write variables, values, which can be changed frequently in the server run, into the configuration file, which directly allows the prog
Delphi has been working with XML since long ago, the latest version contains three kinds of XML interpreter, one is MSXML, look at the name to knowThis is Microsoft's own, according to Delphi official said is the speed is the fastest, but can only be used on Windows. The other two areOmnixml, ADOM, these two are cross-platform. But the speed is slower than MSXML. Inside Delphi 10.2, WINDOWSApps use MSXML by
1. Open and close the fileThe data structure of the Xml\yaml file in OpenCV is Filestorage, which opens operations such as:string " I.xml " ; Filestorage FS (filename, filestorage::write); \\...fs.open (filename, filestorage::read);The file close operation will be done automatically when the filestorage structure is destroyed, but it can also be called the following function implementationFs.release ();2. I
Label: style blog Io color OS AR for SP
The data structure of the XML \ yaml file in opencv is filestorage.
String filename = "I. xml"; filestorage FS (filename, filestorage: Write); \... Fs. Open (filename, filestorage: Read );
FS. Release ();
Use the
FS
Int itnr; FS ["iterationnr"]> itnr; itnr = (INT) FS ["iterationnr"];
JSON
Http://www.json.org/json-zh.html
The following code shows its advantages.VaR namestr = '[{"first": "San", "last": "Zhang", "Age": 24 },{ "first": "Si ", "last": "Li", "Age": 22}] ';
VaR nameobjs = eval ('+ namestr + ')');
For (var I in nameobjs )...{
Document. Write (nameobjs [I]. First + ',' + nameobjs [I]. Last + ',' + nameobjs [I]. Age + '}
JSON is out of the box with Ajax, and JavaScript built-in Parsing is converted to JavaScript objects.
YamlHttp://yaml.org/It seems that Ruby
# Include
Note: The mydata. xml and mydata.yaml files are created on the hard drive. You can create two text files named mydata.txt and change the suffix to. xml and. yaml respectively.
This example describes the PHP read configuration file class instance. Share to everyone for your reference. as follows:
/** * For PHP configuration, such as the configuration file *config.php
1. INI is a bit outdated??2. XML is better,3. Yaml is good, but it is not standardized after all.4. txt to organize their own format, the open is not good.5. Class serialization. Relatively good, but
YAMLOverview: it is an intuitive data serialization format that can be recognized by computers.In YAML, the structure is represented by indentation, and consecutive items are represented by minus signs "-". The key/value pairs in the map structure are separated by colons.YAML can also be used to describe the abbreviation Syntax of several lines of data with the same structure. arrays are included with '[]', and hash is included.Example:
[Python]Root:U
Javaeye http://angeloce.iteye.com/admin/blogs/385976
========================================================== ============
Yaml is an intuitive data serialization format that can be recognized by computers. It is easy for humans to read and interact with scripting languages. Yaml is similar to XML, but its syntax is much simpler than
YAML Pre-research document YAML OverviewYAML is a recursive abbreviation for "Yaml Ain t a Markup Language" (Yaml is not a set-up language), and the previous yaml means "yet another Markup Language" (another kind of labeling language), But in order to emphasize that the lang
Basic rules
YAML has the following basic rules:
1, Case sensitive
2. Use indentation to represent hierarchical relationships
3, prohibit the use of tab indentation, you can only use the space key
4. There is no limit to the indentation length, as long as the element alignment indicates that the elements belong to a hierarchy.
5. Use # to indicate comments
6. Strings can be marked without quotation marks
1, map, hash list
Use a colon (:) to denote a ke
This article is reproduced in the article, the original address: Http://www.ruanyifeng.com/blog/2016/07/yaml.html?f=tt
Programming is unavoidable to write configuration files, how to write configuration is also a learning.
YAML is a language dedicated to writing configuration files, very concise and powerful, far more convenient than JSON format.
This article describes the syntax of YAML, taking the implem
Atitit. Selection of manual configuration list files and data hierarchy Attilax summarize best practices --yaml1. Yaml is a good choice : 12. Hierarchical structure of data-structure:hash,list, and block literal. 13. Yaml differs from JSON implementation 14. the advantages of XML and JSON issues 24.1. IDE- friendly 24.2. JSON is also suitable with any data, c
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.