1. XML vs JSON: The Faceoff
What they have in common
•“self-describing” – allow the user to
name the embedded values
•human and machine readable
•Unicode
•AJAX
2. XML - eXtensible Markup Language
Widely used/W3C Standard/Security
XmlHttpRequest limits applications to retrieve information from
own server (proxy workaround available)
<?xml version=“1.0” encoding=“UTF-8” ?>
<order>
<product id=“0764557599”>
<name> Bundaberg Soft Drink </name>
<quantity>1</quantity>
<price>4.99</price>
</product>
<product id=“4504517519”>
<name>Tip Top Icecream</name>
<quantity>1</quantity>
3. JSON - JavaScript Object Notation
Lightweight
Easy to parse
Cross-domain
Transportation independent -
sent to browser without XMLHttpRequest
Var aOrder = [
{
“product id”: “0764557599”,
“name”: “Bundaberg Soft Drink Sarsparilla”,
“quantity”: “1”,
“price”: “4.99”
},
{
“product id”: “4504517519”,
“name”: “Tip Top Icecream”,
“quantity”: “1”,
“price”: “3.99”
}
];