An internal DTD declaration means the DTD rules are written inside the XML file itself, instead of being in a separate .dtd file.
Here’s a small example:
<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to, from, heading, body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Alice</to>
<from>Bob</from>
<heading>Reminder</heading>
<body>Don't forget our meeting at 10 AM tomorrow.</body>
</note>
Key points:
-
The <!DOCTYPE note [ ... ]> section contains the internal DTD.
-
The <!ELEMENT> declarations define each allowed element and what they contain.
-
Since it’s internal, it’s embedded right in the XML — no external file is referenced.