88

I fail to see what makes YAML any less of a markup language than XML. The purpose of a markup language is to define the structure of a document, and YAML does exactly that (YAML stands for YAML ain't markup language).

What YAML should instead stand for is, Yet another markup language.

Yash Joshi
  • 557
  • 7
  • 25
desbest
  • 4,746
  • 11
  • 51
  • 84

5 Answers5

186

Here's the real story... :)

Clark, Oren and I started working on YAML in April 2001. Oren and Clark were part of the SML mailing list, which was trying to make XML simpler. I had just written a data serialization language for Perl called Data::Denter. Clark contacted me to tell me about an idea they had called YAML, which looked similar to Data::Denter syntax. Clark already had acquired yaml.org.

After a few months of us working together, I pointed out that YAML (which most definitely stood for Yet Another Markup Language at that time) was not really a markup language (marking up various elements of a text document) but a serialization language (textual representation of typed/cyclical data graphs). We all liked the name YAML, so we backronymed it to mean YAML Ain't Markup Language.

http://yaml.org/spec/ starts with:

YAML™ (rhymes with “camel”) is a human-friendly, cross language, Unicode based data serialization language designed around the common native data structures of agile programming languages.

I couldn't have said it better myself… :

ingydotnet
  • 2,466
  • 2
  • 16
  • 10
  • 2
    Well, that's an amusingly full-circle answer. – ViggyNash Sep 19 '17 at 14:35
  • 7
    There is an infinite recursion in the backronym! It never answers what Y stands for. It might as well be called CAML - CAML Ain't Markup Language. – Dojo Oct 30 '19 at 07:57
  • 2
    @Dojo that's how recursive acronyms work . GNU="GNU's Not Unix". PHP="PHP Hypertext Preprocessor" (originally "Personal Home Page"). I'm sure there are many others. – iconoclast Mar 07 '23 at 20:53
74

So, a markup language presumes a base text, typically human readable, and then special indicators or "markup" which direct processing. The idea comes from an editor, who would take a printed-version of someone's manuscript, and "mark it up" to show where new lines should go, edits, etc.

In this manner, SGML is a meta-language for declaring markup languages, and HTML is a markup language. In 1996-7, when XML came on the scene, it was sold as a simplified SGML meta-language for creating markup languages. In XML (and SGML), you have elements to "mark" a portion of text, and then attributes that modify the marking. Over time, XML was used for much more than document markup though, people used it for data serialization -- even though it was never designed to do such a thing. Of course, it was the big problem to be solved.

YAML and JSON appeared on the scene and focused on data serialization, not document markup. In these languages, there simply isn't a core document text.
Hence, YAML Ain't Markup Language is quite an accurate differentiator from XML.

clarkevans
  • 957
  • 6
  • 6
  • 15
    As a historical note, YAML emerged from the "SML" ("simple-markup-language") group. The problem this group ran into wasn't actually the syntax: it was with the core information model that XML used. The XML information model (encoded these days as DOM) was excellent for text-oriented web pages. It was hugely burdensome for data serialization. The primary question that kept popping up in the SML-LIST discussions was: "attribute or element?". The answer, for data serialization: neither. The question itself is flawed. As such, YAML was first a data model for serialization, then a syntax. – clarkevans Aug 06 '11 at 18:02
  • But... Really the first letter could by any letter... why choose "Y"? – Michael Tamillow Feb 07 '21 at 02:06
5

XML inherited the "ML" part of its name from HTML and SGML, which are "markup" languages in that what they describe is a stream of plain text together with markup instructions such as "this piece of the text should be bold" or "this piece of the text is a heading". That is, those particular parts of the text are marked up as being bold, or a heading.

Later, some people took to writing XML that consisted only of tags and attributes, with no plain text for those tags to mark up. (Opinions and styles differ as to whether that is an appropriate use of XML). When used that way, XML becomes a language for writing down tree-structured data.

YAML is "not a" markup language because its data model contains only the tree structure, with no notion of an underlying linear text that the tree structure applies to. There's nothing to mark up there -- or put differently, the data represented by a YAML stream is not markup. In contrast, the data represented by an XML tag is markup, or at least according to some points of view is supposed to be. (In both cases, the representation of said data contains some markup, such as colons and indentations in YAML or '=' and quotes in XML, but that is not the point).

InteXX
  • 6,135
  • 6
  • 43
  • 80
hmakholm left over Monica
  • 23,074
  • 3
  • 51
  • 73
  • "Later, some people took to writing XML that consisted only of tags and attributes, with no plain text for those tags to mark up." So does that mean that `` **isn't** a markup language, whereas `The ShiningStephen King` **is**, because text is actually being marked up? – desbest Aug 06 '11 at 18:54
  • 1
    The _language_ itself is what it is, no matter how you happen to use it. In your first example, you're not _using_ it _as_ a markup language, not that there's anything morally bad about that. It's the style I use myself when I serialize things as XML, though there are plenty of people who will tell you that's Doing It Rong. It's fine in my book not to write things as text-with-markup when that's not what they actually are. The underlying plain text "The ShiningStephen King" does not make much sense of its own, after all. – hmakholm left over Monica Aug 06 '11 at 21:32
2

Here's a quote from a page about YAML:

I suppose the very first question on readers' minds has to be, "why the name YAML?" There are a number of tools that have cutely adopted acronyms of the form "YA*", to mean "Yet Another XXX." In the arms race of open-source wit, YAML eschews its implied acronym, instead settling on the recursive "YAML Ain't Markup Language." There is a certain sense to this, however: YAML does what markup languages do, but without requiring any, well, markup.

The name was chosen because it requires much less markup than other than other traditional languages, such as XML. It distinguishes it as more data-oriented rather than markup-oriented.

EdoDodo
  • 8,220
  • 3
  • 24
  • 30
  • 2
    Why does YAML require less markup; and if it does require less markup, doesn't that make it a markup language? – desbest Aug 06 '11 at 18:59
-6

I fail to see what makes YAML any less of a markup language than XML.

There are a few advantages of using YAML instead of XML. First of all, it is a more human-readable. Not like XML data structure, we have to define and give tag name of each data elements. Developers would feel bulky for the XML code and users are quite hard to understand the XML documents. Actually, XML is for machine to machine communication, not for users-machine communication. Since YAML is kindly human-readable, you can treat it for users to read/change data source and used it to communicate with computer program.

Here is an example showing how's their structures are different.

XML Examples:
<busNo>101
    <busStop>ABC
           <busFee>5.4</busFee>
    </busStop>
    <busStop>CUHK
           <busFee>5.4</busFee>
    </busStop>
    <busStop>HKU
           <busFee>5.4</busFee>
    </busStop>
    <busStop>XYZ
           <busFee>5.4</busFee>
    </busStop>
</busNo>

YAML Examples:
--- #bus no
101  : [ABC:5.4, HKU:5.4, CUHK:5.4, XYZ:5.4]

The best example to use YAML is used for configuration file of the program. Certainly, you can parse your own format of configuration file into XML and pass it into your program. But, you can use YAML instead. Also, you could have faster development, especially on web development. YAML is designed with scripting languages such as Python, Perl, Ruby.etc. YAML is designed to translate easily to strucutres which are common to various languages stated above.

In conclusion, YAML is designed for human-read, which make less of a markup language than XML.

Community
  • 1
  • 1
TheOneTeam
  • 25,806
  • 45
  • 116
  • 158
  • 2
    The question was about why YAML stands for *YAML Ain't Markup Language*. This doesn't really answer it. – EdoDodo Aug 06 '11 at 17:27
  • @EdoDodo: he is asking "I fail to see what makes YAML any less of a markup language than XML." and i am explaining. – TheOneTeam Aug 06 '11 at 17:29
  • 11
    What you've done is you've compared the syntax of XML and YAML, by saying that XML requires tags and is tiresome, and that YAML requires two space indentations and is easier to type out. Such comparisation of how a language is formatted does NOT explain the differences. That's like comparing PHP's and Ruby's syntax, and then saying that not having a `$` for variables and `;` to end statements make them not a programming language. You have NOT answered the question. A more human readable markup doesn't make a language any less or more `markup` than another one. – desbest Aug 06 '11 at 18:48
  • Your YAML example definitely fits the conventions that most people use YAML for. However, it is not at all comparable to the XML you gave above. Instead of setting the value of 101 as an array of bus stops... you could have the value of 101 be an object, where the property "busStops" is the array of bus stops. Similarly, each stop could be an object with the property name ("XYZ"), and the property busFee ("5.4"). YAML can represent the same structure just fine, but your example has it representing a different structure, one where the program must make more assumptions. – RoboticRenaissance Sep 16 '21 at 15:37