posted 18 years ago
XML is extensible.
For example,
<PERSON><NAME>JESUS</NAME></PERSON>
Therefore, there may come a need to make it strict, like in business to business communication using XML as their language.
DTD is an old way of stating rules on the contents of an XML instance.
For example, in informal way, you can create a DTD that says that the PERSON tag must have exactly 2 NAME entries. So the xml instance above will fail XML checking(called parsing/validation), because it only have 1 NAME tag. This one will pass validation:
<PERSON><NAME>JESUS</NAME><NAME>ANGELES</NAME></PERSON>
SCHEMA is a newer, more powerful way of stating rules on the contents of an XML instance.
For example, same thing, as the sample in DTD above.
DTD and SCHEMA are different. DTD is written in its own language. SCHEMA is written in XML form.