xml DTD XML document with an external DTD

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

In external DTD elements are declared outside the XML file. They are accessed by specifying the system attributes which may be either the legal .dtd file or a valid URL. To reference it as external DTD, the standalone attribute in the XML declaration must be set as no.

An XML that describes a note that contains property to, from and the message is given below.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
  <to>Mr.X</to>
  <from>Mr.Y</from>
  <message>Stack Overflow is awesome</message>
</note>

External DTD for the above XML, note.dtd is given below

<!DOCTYPE note [
<!ELEMENT note (to,from,message>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT message (#PCDATA)>
]>


Got any xml Question?