YAML YAML

YAML - Definition and Overview

YAML is a recursive acronym for "YAML Ain't Markup Language". YAML is a data serialization language that takes concepts from languages such as XML, C, Python, and Perl, as well as the format for electronic mail as specified by RFC 2822 (http://www.rfc-editor.org/rfc/rfc2822.txt). YAML was first proposed by Clark Evans, and implemented by himself, Brian Ingerson and Oren Ben-Kiki.

Contents

Features

YAML was created with the belief that all data can be adequately represented by combinations of lists, hashes, and scalar data. The syntax is relatively straightforward and was designed with human readability in mind, but also to be easily mapped to data types common to most high-level languages:

  • Comments are denoted by the pound sign (#) and continue until the end of the line
  • List members are denoted by a leading hyphen (-) with one member per line, or as comma-separated values enclosed in brackets ([ & ])
  • Hashes are represented in the form key: value, either one per line or enclosed in parentheses (( & )) and delimited by commas
  • Scalars may be double-quoted ("), single-quoted ('), or represented by an indented block with optional modifiers to preserve (|) or fold (>) newlines
  • Multiple documents within a single stream are separated by three hyphens (---); three periods (...) optionally end a document within a stream
  • Repeated nodes are initially denoted by an ampersand (&) and thereafter referenced with an asterisk (*)

Examples

Lists

--- # Favorite movies, block format
- Casablanca
- Spellbound
- Notorious
--- # Shopping list, inline format
[milk, bread, eggs]

Hashes

--- # Block
name: John Smith
age: 33
--- # Inline
(name: John Smith, age: 33)

Block Literals

Newlines preserved

--- |
  There was a young fellow of Warwick
  Who had reason for feeling euphoric
      For he could, by election
      Have triune erection
  Ionic, Corinthian, and Doric

Newlines folded

--- >
  Wrapped text
  will be folded
  into a single
  paragraph
  
  Blank lines denote
  paragraph breaks

Lists of Hashes

- (name: John Smith, age: 33)
-
  name: Mary Smith
  age: 27

Hashes of Lists

men: [John Smith, Bill Jones]
women:
  - Mary Smith
  - Susan Williams

Implementations

Bindings for YAML exist for the following languages:

External links


Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.