An XML document with correct syntax is called "Well Formed".
A "Valid" XML document must also conform to a document type definition.
An XML document with correct syntax is "Well Formed".
The syntax rules were described in the previous chapters:
To help you check the syntax of your XML files, we have created an XML validator to syntax-check your XML.
A "valid" XML document is not the same as a "well formed" XML document.
A "valid" XML document must be well formed. In addition it must conform to a document type definition.
Rules that defines the legal elements and attributes for XML documents are called Document Type Definitions (DTD) or XML Schemas.
There are two different document type definitions that can be used with XML:
With a DTD, independent groups of people can agree to use a standard DTD for interchanging data.
Your application can use a standard DTD to verify that the data you receive from the outside world is valid.
You can also use a DTD to verify your own data.
XML does not require a DTD/Schema.
When you are experimenting with XML, or when you are working with small XML files, creating DTDs may be a waste of time.
If you develop applications, wait until the specification is stable before you add a document definition. Otherwise, your software might stop working because of validation errors.