
XML provides a very specific way of structuring information and of looking at the world. It asks us to identify pieces of information that we are interested in, and it asks us to group them together. We can represent these groupings in various different visual ways, all of which represent the same thing—XML’s structure. The first useful metaphor is that of a set of nested boxes, like in the example on the left. These boxes always nest perfectly within each other, and do not overlap. You can also think about the structure of XML as being like a tree, as in the middle example. Each XML document is a complete tree, and each XML element is like a branch of that tree. The example on the right shows XML as it is written, using a system of tags that mark the boundaries of the boxes and the structural groupings that make up the informational system. Each box or tree node (or element in XML parlance) is represented by a pair of tags that mark its beginning and its end, and these elements can be nested inside one another.