XML DTD
XML DTD :
- DTD stands for Document Type Definition.
- A DTD allows you to create rules for the elements within your XML documents.
- Although XML itself has rules, the rules defined in a DTD are specific to your own needs.
Syntax
Example
Internal DTD
- The following example demonstrates Internal DTD.
- Doctype with DTD will be placed inside the XML
- Elements and tags will be accessed by the xml from DTD.
Syntax
root-element is the name of root element and element-declarations is where you declare the elements.
Learn XML - XML tutorial - XML DTD - XML examples - XML programs
External DTD
- The following example demonstrates External DTD.
- Doctype with DTD will be placed as a separate file.
- Elements and tags will be accessed by the xml file from DTD file.
Syntax
file-name is the file with .dtd extension
Learn XML - XML tutorial - XML External DTD - XML examples - XML programs