DTD is Document Type Definition.
It states what tags and attributes are used to describe content in an SGML, XML or HTML document,
where each tag is allowed, and which tags can appear within other tags.
For example, in a Document Type Definition one could say that LIST tags can contain ITEM tags,
but ITEM tags cannot contain LIST tags.
It can be declared inline in the XML document, or as an external reference.
Internal DOCTYPE declaration
If the DTD is included in an XML source file,
it should be wrapped in a DOCTYPE definition.
Syntax:
<!DOCTYPE root-element [element-declarations]>
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>Sam</to>
<from>Ros</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>
External DOCTYPE declaration
If the DTD is external to the XML source file,
it should be wrapped in a DOCTYPE definition.
Syntax:
<!DOCTYPE root-element SYSTEM "filename">
Example:This is the same XML document as above, but with an external DTD.
<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
<to>Sam</to>
<from>Ros</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
This is a copy of the file "note.dtd" containing the DTD
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:xml dtd, dtd html 4.01 transitional, dtd file, xml file create code dtd,
dtd html 4.0 transitional, dtd team 1.1 download, internal dtd, dtd example