It does not rigorously define this grammar, nor does it define the entire grammar used in DTDs. Among other things, the grammar for notations and entities is omitted. For a complete definition of the DTD grammar, see the XML specification or the annotated XML specification . The examples below often redefine the same element. An XML document primarily consists of a strictly nested hierarchy of elements with a single root.
Elements can contain character data, child elements, or a mixture of both.
In addition, they can have attributes. This is chapter 1. It is not very long or interesting. This is chapter 2. Although it is longer than chapter 1, it is not any more interesting.