A well formed XML document can be validated against DTD or Schema.
A well-formed XML document is an XML document with correct syntax. It is very necessary to know about valid XML document before knowing XML validation.
Valid XML document
It must be well formed (satisfy all the basic syntax condition)
It should be behave according to predefined DTD or XML schema
Rules for well formed XML
A DTD defines the legal elements of an XML document
In simple words we can say that a DTD defines the document structure with a list of legal elements and attributes.
XML schema is a XML based alternative to DTD.
Actually DTD and XML schema both are used to form a well formed XML document.
We should avoid errors in XML documents because they will stop the XML programs.
It is defined as an XML language
Uses namespaces to allow for reuses of existing definitions
It supports a large number of built in data types and definition of derived data types