| Internal DTD | External DTD |
|---|---|
| Internal DTD is part of the document. | External DTD is a separate file. |
| The scope is limited to the document which is created. | It is accessible across the multiple documents. |
| Syntax: <!DOCTYPE rootelement[element and attribute declarations]> | Syntax: <!DOCTYPE rootelement|SYSTEM “path of .dtd file”> |
| Element type | Description | DTD Declaration |
|---|---|---|
| Empty | Contains attributes, but can't contain text or any other element. | <!Element elementname EMPTY> |
| Unrestricted | Contains text content or any other element. | <!ELEMENT elementname ANY> |
| Container | Contain another elements. | <!ELEMENT elementname (elementname, elementname [elementname])> |
| Value Type | Description |
|---|---|
| PCDATA | Represents the plain text values. |
| ID | Assigns unique value to each element in the document. |
| (enumerated) | Assigns a specific range of values which is specified within parenthesis. |
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE Employee
[
<!ELEMENT address (name,company,phone)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT company (#PCDATA)>
<!ELEMENT phone (#PCDATA)>
]>
<address>
<name>Mayuri S</name>
<company>TutorialRide</company>
<phone>91-9800000000</phone>
</address>