What Is a Valid XML Document?

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.

Get Sams Teach Yourself XML in 10 Minutes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.