Overview of DTD
Document Type Definition(DTD) includes the formal specification that describes the structure, legal elements, and attributes of an XML Document. We can say that it acts like a rulebook that specifies the structure and relationship between the elements of an XML Document. It also checks the validity and vocabulary against the grammatical rules of XML language.
Moreover, it defines the elements, their syntax, and rules to use them in an XML document. Hence, a valid and well-formed XML document must conform to the DTD specifications. Below is the syntax of DTD in a ‘sample.dtd’ file:
<!DOCTYPE rootElement [
<!-- DTD rules are defined here →
Declaration 1…
Declaration 2…
]>
Where the DOCTYPE is a delimiter, rootElement is the starting element parsed by the parser, and the square brackets define the list of declarations.
DTD Components
Markup Languages play a very important role in encoding and standardizing information that is shared over the web. XML (Extensible Markup Language), being one of those languages, provides a set of rules to encode data in the document which is both human as well as machine-readable.
For this, XML uses a unique specification norm to define the structure of a document which is called a Document Type Definition (DTD). In this article, we have covered every minute detail about DTD and its components. So, without any delay, let us delve deep into the DTD Components.
Table of Content
- Overview of DTD
- What are DTD Components?
- Examples of DTD Components
- Features of DTD Components
- Advantages of DTD Components
- Disadvantages of DTD Components
- Conclusion