Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YAML compared to XML [closed]

I read that after years yaml will be used instead of xml. Please compare the relative advantages and disadvantages of each specification.

like image 905
Iguramu Avatar asked Aug 20 '09 20:08

Iguramu


People also ask

Is YAML more readable than JSON and XML?

YAML, depending on how you use it, can be more readable than JSON. JSON is often faster and is probably still interoperable with more systems. It's possible to write a "good enough" JSON parser very quickly.

Is YAML like XML?

XML is an eXtensible Markup Language while Yaml is a human-readable data-serialization language. Let us look at the comparison of both languages in terms of their file structure, syntax and usage.

What is the advantage of YAML file?

Advantages of YAML Files are easy to work in a text editor. Files are portable between programming languages. Files are expressive and also extensible. Files support the Unicode character set.

What is the difference between XML and JSON and YAML?

YAML stands for “YAML Aint Markup Language“. JSON stands for “JavaScript Object Notation“. XML is “eXtensible Markup Language” whereas YML is not a markup language. XML uses a tag to define the structure just like HTML.


1 Answers

YAML is much less verbose. The signal-to-noise ratio is higher without all the brackets. This makes it subjectively easier to read and edit for many people. On the flip side, it's slightly (only slightly) harder to parse.

The biggest difference, though, is that XML is meant to be a markup language and YAML is really more of a data format. Representing simple, hierarchical data tends to be more gracefully done in YAML, but actual marked-up text is awkward to represent.

EDIT: I'd like to add, for reference, that YAML is essentially (though not historically) a "cleaner" version of JSON ("Javascript Object Notation") that largely eliminates the latter's perceived line noise (brackets and braces). If you can't find a suitable YAML library for a particular project, then JSON is a more widely-supported alternative with many of YAML's advantages.

like image 98
Thom Smith Avatar answered Nov 11 '22 14:11

Thom Smith