Chapter 6. XML Validation: DTD
We have seen that XML can describe nearly any data. It offers tremendous flexibility as nothing is predefined. The element names we use have no intrinsic meaning in the XML standard. We make them up as we go along to describe our data.
Similarly, there are no rules about how the single document element organizes its component elements or how those elements are themselves composed . They too are established to fit the data being modeled .
This practice is fragile. To be useful, the producer and the consumer of an XML document must agree on the structure of the document and each of its elements. In this chapter we will learn to create formal declarations of XML vocabularies.
Several formats have been proposed to formalize these designs. The original (and simplest) is Document Type Definition (DTD). We will learn the syntax of DTD, and we will use it to express a data design and validate compliance.
There are other important uses for DTD, and exposure to them is necessary for a solid understanding of XML. But none of these advantages will be exploited by Flash applications here or elsewhere. The Flash XML parser does not parse DTDs directly. Reliance on these techniques will create problems. So we learn to use the DTD only to create macro shortcuts and conditionally compile.