A document type definition is an optional schema which can be used to validate that an XML document meets a certain list of criteria, through an online XML Validator or in real time with a Language Server.
This can be often useful as, if another program wishes to interpret some XML, knowing the shape of that data beforehand vastly simplifies the process.
Example
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)>
<!ATTLIST note date-sent CDATA #REQUIRED>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note date-sent="05/12/2024">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>