Question: why we need dtd in xml?
Answer: The purpose of a DTD (Document Type Definition) is to define the legal building blocks of an XML document. A DTD defines the document structure with a list of legal elements and attributes. You can validate your XML-Document to see if it only uses the by you pre-defined tags in your DTD.