The debate of YAML vs XML and XML vs JSON is not new...
Can YAML really replace XML?
To be frank, whatever can be done in XML can be done without XML.
Do you need XML for XML-RPC? Yes,
Is it necessary to use XML for RPC? No.
Is it necessary to use XML for RDF? No.
Is it necessary to use XML for, anything? No.
Is YAML a perfect replacement for XML? No
Are there circumstances, YAML may be more suitable than XML.
http://www.ibm.com/developerworks/xml/library/x-matters23.html
YAML is designed with scripting languages (such as Python, Perl, PHP, and
Ruby, among others) in mind.
Using Python to parse YAML
PyYAML is designed to be a Python parser.
<user id="MyPBX" on="localbox">
<firstname>John</firstname>
<lastname>QPublic</lastname>
<department>QA</department>
<cell>678-255-1185</cell>
<address password="xxxx">[EMAIL PROTECTED]</address>
<address password="xxxx">[EMAIL PROTECTED]</address>
</user>
Now, contrast this with what I would enter for the YAML file:
MyPBX:
computer : localbox
firstname: John
lastname: QPublic
cell: 678-255-1185
addresses:
- address: [EMAIL PROTECTED]
password: xxxxxxxx
- address: [EMAIL PROTECTED]
password: xxxxxxxx
Assuming we created a yaml document, and read the above YAML structure into
Python, the resulting structure may look like:
{mypbx: {computer: localbox, firstname: John, lastname: QPublic, cell: 678,
255,1212, addresses: [{address: [EMAIL PROTECTED], password:
xxxxxxxx},{address: [EMAIL PROTECTED], password: xxxxxxxx}]}
http://www.yaml.org/refcard.html
http://yaml4r.sourceforge.net/cookbook/
http://pyyaml.org/
So what about JSON then. is not JSON better than XML, YAML or OGDL?
http://scripting.wordpress.com/2006/12/20/scripting-news-for-12202006/
Briefly these do similar things in a different way.
JSON works well with Javascript.
YAML works without modification in Python and Ruby.
XML works with almost every language having xml libraries.
OGDL is similar to YAML and seems to now be adopted by JAVA
http://ogdl.sourceforge.net/
_______________________________________________
Freeswitch-users mailing list
[email protected]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org