January 2003
Beginner to intermediate
1200 pages
23h 42m
English
Most XML browsers will check your document to see if it is well formed. Some of them can also check whether it's valid. An XML document is valid if there is a document type definition (DTD) or XML schema associated with it, and if the document complies with that DTD or schema.
A document's DTD or schema specifies the correct syntax of the document, as we'll see in Chapter 3, “Valid Documents: Creating Document Type Definitions,” for DTDs and Chapter 5, “Creating XML Schemas,” for schemas. For example, DTDs can be stored in a separate file, or they can be stored in the document itself using a <!DOCTYPE> element. Here's an example in which I add a <!DOCTYPE> element to the greeting XML document we developed earlier: