XML and JSON

Notes

XML resources

Our book (Fundamentals of Web Development) has some information about XML, but here are links to a few web sites that have information about XML:
XML for the absolute beginner by Mark Johnson, JavaWorld.com 1999
http://www.javaworld.com/javaworld/jw-04-1999/jw-04-xml.html
Although this is a very old web page, and it's on a Java web site, it's still a good introduction to XML. You'll want to also read the w3schools tutorial about DTDs, since this page doesn't explain a lot about DTDs.

XML tutorial at w3schools
http://www.w3schools.com/xml/default.asp

XML DTD tutorial at w3schools
http://www.w3schools.com/xml/xml_dtd_intro.asp

XML schemas

There are two main ways of validating XML documents: with a DTD (Document Type Definition), or with a schema. Schemas are more powerful, but they are complicated and we don't have time to cover them in this course. The only thing that you need to know about them is that they are a way of validating XML documents. You don't need to use them in Assignment 6 or on the project.

JSON

Here is a link to the w3schools JSON tutorial: https://www.w3schools.com/js/js_json_intro.asp

Here's another JSON tutorial: http://www.tutorialspoint.com/json/
In particular, the Quick Guide in that tutorial is a good summary: http://www.tutorialspoint.com/json/json_quick_guide.htm
NOTE: This tutorial uses document.write, and some code in our textbook (Fundamentals of Web Development) also uses document.write. document.write makes some examples simpler, but it has some major issues and should not be used in the code you write for this class or for any production code.

XML vs. JSON

Here are some links that compare XML and JSON:
http://stackoverflow.com/questions/4862310/json-and-xml-comparison
http://www.json.org/xml.html

For me, the bottom line is that JSON is easier to use and less verbose, but XML has more and better validation tools, and it can include more kinds of data. Also, I think XML works better for large documents.