yaml

http://www.ibm.com/developerworks/cn/xml/x-1103linrr/index.html

YAML 的数据组织主要依靠的是空白,缩进,分行等结构。
YAML 的语法十分简单:
用'-'来表示一些序列的项(Sequence),如清单 1 里的产品(product)有两样东西(Basketball 和 Super Hoop)组织为一个序列.
用':'来表示一对项目(Map)里的栏目(Key)和其相应的值(Value),比如清单 1 发票里的时间(date)的值是 2001-01-23,这就是一个 Map.
如果想知道其他语法的细节可以参看 YAML 官方网页里的参考卡片(reference card):http://www.yaml.org/refcard.html

 --- !clarkevans.com/^invoice 
 invoice: 34843 
 date : 2001-01-23 
 bill-to: &id001 
  given : Chris 
  family : Dumars 
  address: 
  lines: | 
  458 Walkman Dr. 
  Suite #292 
  city : Royal Oak 
  state : MI 
  postal : 48046 
 ship-to: *id001 
 product: 
  - sku : BL394D 
  quantity : 4 
  description : Basketball 
  price : 450.00 
  - sku : BL4438H 
  quantity : 1 
  description : Super Hoop 
  price : 2392.00 
 tax : 251.42 
 total: 4443.52 
 comments: > 
  Late afternoon is best. 
  Backup contact is Nancy 
  Billsmer @ 338-4338.
 node_a: 
  conntimeout: 300 
  external: 
  iface: eth0 
  port: 556 
  internal: 
  iface: eth0 
 port: 778 
  broadcast: 
  client: 1000 
  server: 2000 
 node_b: 
  0: 
  ip: 10.0.0.1 
  name: b1 
  1: 
  ip: 10.0.0.2 
  name: b2
{"node_a"=>{ 
  "internal"=>{ 
  "broadcast"=>{ 
  "client"=>1000, 
  "server"=>2000 
  }, 
  "port"=>778, 
  "iface"=>"eth0"
  }, 
  "conntimeout"=>300, 
  "external"=>{ 
  "port"=>556, 
  "iface"=>"eth0"
  } 
 }, 
"node_b"=>{ 
  0=>{ 
  "name"=>"b1", 
  "ip"=>"10.0.0.1" 
  }, 
  1=>{ 
  "name"=>"b2", 
  "ip"=>"10.0.0.2"
  } 
 } 
 }

你可能感兴趣的:(yaml)