The syntax of XML is rather straightforward, with only a few simple rules to follow. Some of these rules are a little more complex than others but are still much easier to understand than most Internet technologies out there.
An XML document can be either well-formed or valid. A well-formed document adheres to a number of well-formedness constraints detailed in the XML specification. And an XML document is valid if, to quote the XML specification, "… it has an associated document type declaration and if the document complies with the constraints expressed in it." You'll learn about document type declarations and valid XML documents later in the chapter.