An XML document is well-formed if it conforms to the rules governing the format of XML documents. By definition, all XML documents are well-formed. Otherwise, they would not be XML documents.
An XML document is valid if it conforms to a particular Document Type Definition, or DTD. A DTD is a pre-defined specification governing the structure of an XML document. The DTD contains rules about which elements and attributes are mandatory or optional. It also specifies rules about in what order the elements can appear. Software that processes data from XML documents relies on those documents conforming to the associated DTD. Otherwise, the software can fail. Many industries have developed DTDs so that users can exchange data easily, regardless of what kind of computer they're using and what kind of software is processing the information. The table below lists a few recognized DTDs:
| Industry | Name of Document Type Definition | Acronym |
| Food and Culinary Review | Recipe Markup Language | RecipeML |
| Billing & Accounting | INVOICE.DTD | INVOICE.DTD |
| Vehicle Financing | Credit Application Format | CAF |
| Human Resources / Staffing | Staffing Exchange Protocol | SEP |