Skip to content

Instantly share code, notes, and snippets.

@glarizza
Created August 12, 2012 16:27
Show Gist options
  • Save glarizza/3332629 to your computer and use it in GitHub Desktop.
Save glarizza/3332629 to your computer and use it in GitHub Desktop.
XML versus YAML
>> hash = { 'key' => 'value' }
=> {"key"=>"value"}
>> hash.to_yaml
=> "--- \nkey: value\n"
>> Plist::Emit.dump(hash)
=> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>key</key>\n\t<string>value</string>\n</dict>\n</plist>\n"
## Here's YAML:
---
key : value
## Now, Here's a Plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-/Apple Computer/DTD PLIST 1.0/EN "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>key</key>
<string>value</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment