XML DTD vs XSD
Both Document Type Definition (DTD) and XML Schema Definition (XSD) are used to validate XML Documents.
They have the same purpose but they are different. The following table compares DTD and XSD:
DTD | XSD |
---|---|
DTD stands for Document Type Definition. | XSD stands for XML Schema Definition. |
DTDs are derived from SGML syntax. | XSDs are written in XML. |
DTD doesn't support datatypes. | XSD supports datatypes for elements and attributes. |
DTD doesn't support namespace. | XSD supports namespace. |
DTD doesn't define order for child elements. | XSD defines order for child elements. |
DTD is not extensible. | XSD is extensible. |
DTD is not simple to learn. | XSD is simple to learn because you don't need to learn new language. |
DTD provides less control on XML structure. | XSD provides more control on XML structure. |