YAML Ain't Markup Language

by Simon St. Laurent

Related link: http://yaml.org/spec/

While I have a reputation for being impatient with people who just see XML as a serialization format, I'm happy to report that I'm quite pleased with a project called YAML that seeks explicitly to come up with a better text-based serialization format than XML.

Long ago, YAML was "Yet Another Markup Language", part of the activity which emerged from the SML-DEV mailing list's work on XML simplification. They've changed the name and sharpened the focus on serialization, wisely severing their ties to markup practice per se, which covers a much broader set of issues.

YAML keeps perhaps the largest benefit of XML over its many competitors, a sort-of-human-readable Unicode-based text format. Beyond that, however, YAML has a much tighter focus:

[YAML] is both a human-readable data serialization format and processing model.... YAML document streams encode in a textual form the native data constructs of modern scripting languages. Strings, arrays, hashes, and other user-defined data types are supported. A YAML document stream consists of a sequence of characters, some of which are considered part of the document's content, and others that are used to indicate document structure.

YAML doesn't look much like XML, though it comes up regularly in XML contexts. Kendall Clark noted some of the difficulties YAML has had - and its prospects for emerging from XML's shadow - in an article last year:

In rummaging around for a plain, concise description of YAML, I kept stubbing my toe on a felt need to define it by referring to XML in some way. That was a mistake. YAML stands on its own very nicely, even if its most immediate point of contrast is XML.

If data serialization is your primary concern, take a close look at YAML. It doesn't yet have the tool support that XML has, but it may be a much better fit for the job. YAML seems to me to combine XML's structured text foundation
and ASN.1's programming orientation, perhaps giving programmers the best of both of those worlds without their complications.

Can YAML solve data serialization problems, and let XML focus on markup?


2003-06-06 11:19:20
What about implementations
YAML definately looks interesting, but there doesn't seem to be very tool support in different languages. I am wondering if the syntax of YAML makes it harder to write a parser for it than for XML. Any thoughts?
2003-06-06 14:32:25
What about implementations
There are tools for Perl, Python, Java, Ruby, and PHP, off the top of my head. The syntax is a little less regular than plain-vanilla XML, but I don't have to deal with namespaces or schemas.

That's a big win right there.