An XML document with correct syntax is called "Well Formed".
A "Valid" XML document must also conform to a specified document type.
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.
Please see the next chapter.
A valid XML document is not the same as a well formed XML document.
The first rule, for a valid XML document, is that it must be well formed (see previous paragraph).
The second rule is that a valid XML document must conform to a document type.
Rules that defines legal elements and attributes for XML documents are often called document definitions, or document schemas.
A document definition is the easiest way to provide a reference to the legal elements and attributes of a document.
A document definition also provides a common reference that many users (developers) can share.
A document definition provides a standardization that makes life easier.
XML does not require a document definition.
When you are experimenting with XML, or when you are working with small XML files, creating document definitions 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.
There are different types of document definitions that can be used with XML: