In this example, we'll look at the other format you're likely to want to use—JSON. JSON can model data just as well as XML, but is considerably more compact. As such, it has been growing in popularity in recent years and has all but replaced XML for many tasks.
Once again, you'll want to make sure that you have a file being served by a server that you have access to, but this time you'll want to make sure that it's JSON data. Once again, we'll create some number of cubes and spheres, but this time, we'll specify the data as an array of JSON objects.
The full listing for the example document is as follows:
[ {"type": "cube", "size": 3, "x": 0, "y": 2, "z": 3}, {"type": "sphere", "size": 1, "x": 0, "y": 0, "z": 0} ]
The square brackets indicate an array, and the curly brackets indicate an object. Within an object, there can be any number of named values. Arrays and objects can also be nested, allowing us to have an array of objects, as we do here. For...