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, so there will not be any quiz or test questions on schemas, and you don't need to use them in Assignment 6.

If you want to learn about schemas, here are a few links with information about them:

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.

HTML, XML, and XHTMLL

HTML and XML have some similarities (use of angle brackets, for example) but have some differences in syntax and are used for different purposes. XML has user-defined tags (as opposed to the predefined tags in HTML) and so can be used for many different purposes. XHTML is a version of HTML that follows the rules of XML. At one point, XHTML seemed to be the future of HTML, but now HTML5 receives a lot more attention than XHTML. In spite of the fact that XHTML isn't as prevalent as it used to be, it's still worth taking a look at it because it can help you understand the relationship between XML and HTML.

Here is a link to a good FAQ page that explains the differences between HTML and XHTML:
http://www.sitepoint.com/forums/showthread.php?393445-XHTML-vs-HTML-FAQ
For purposes of this class, the main things you should know are the points in the What is XHTML? and How is XHTML different from HTML sections. In particular, make sure you know read Differences in Syntax Rules.

Another SitePoint page on the topic is at http://reference.sitepoint.com/html/html-vs-xhtml