XML resources

Our book (Modern JavaScript) includes a few pages about XML, but you'll probably want more information. Here are a few links to XML web sites:
XML for the absolute beginner by Mark Johnson, JavaWorld.com 1999
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

XML DTD tutorial at w3schools

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:


Here is a link to the w3schools JSON tutorial: http://www.w3schools.com/json/default.asp

One important note about JSON is that you should not use eval to get a JavaScript object from a JSON string. Instead, use the browser's JSON.parse function, or load a JSON library like json2.js, which you can get from json.org

Using eval is a security risk because if you evaluate a string that contains JavaScript executable statements or functions you could run malicious code in your web app.

Be sure to read this page on json.org: http://www.json.org/js.html. Even though it's not very long, it has good information. In particular, take note of the reviver and replacer parameters to JSON.parse and JSON.stringify. Also note how JSON.stringify uses toJSON functions.

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


Here are some links that compare XML and JSON:

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 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:
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