An XML document that contains a DOCTYPE declaration and that complies with the constraints for that class of XML document expressed in the document type declaration is said to be valid. In other words, a valid XML document must comply with a defined logical structure.
All valid XML documents must be well-formed and must satisfy the well-formedness constraints described in Chapter 3. Some well-formed XML documents lack a DOCTYPE declaration and cannot be valid; others might have a DOCTYPE declaration but not comply fully with its constraints. Those documents are not valid XML, either.