There are many differences between DTD (Document Type Definition) and XSD (XML Schema Definition). In short, DTD provides less control on XML structure whereas XSD (XML schema) provides more control.
The important differences are given below:
No. | DTD | XSD |
---|---|---|
1) | DTD stands for Document Type Definition. | XSD stands for XML Schema Definition. |
2) | DTDs are derived from SGML syntax. | XSDs are written in XML. |
3) | DTD doesn't support datatypes. | XSD supports datatypes for elements and attributes. |
4) | DTD doesn't support namespace. | XSD supports namespace. |
5) | DTD doesn't define order for child elements. | XSD defines order for child elements. |
6) | DTD is not extensible. | XSD is extensible. |
7) | DTD is not simple to learn. | XSD is simple to learn because you don't need to learn new language. |
8) | DTD provides less control on XML structure. | XSD provides more control on XML structure. |