Home >>XML Tutorial >DTD vs XSD
DTD (Document Type Definition) and XSD (XML Schema Definition) vary from each other in several respects. In brief, DTD has less control over the structure of XML whereas XSD (XML schema) offers greater control.
The main differences are listed out 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. |