Home

DTD

Document Type Definition (DTD) is a markup language used to define the structure of an XML document. It specifies the legal elements, attributes, and their relationships, ensuring that XML documents are well-formed and consistent. DTDs use a simple syntax, distinct from XML, starting with <!DOCTYPE. Elements are declared with <!ELEMENT, attributes with <!ATTLIST, and entities with <!ENTITY. For example, a DTD might define that a "book" element must contain "title" and "author" elements, both of which can contain text data.

While DTDs are straightforward and widely supported, they lack advanced features like data typing, which are

Here is an example of a simple DTD:

<!DOCTYPE book [

<!ELEMENT book (title, author)>

<!ELEMENT title (#PCDATA)>

<!ELEMENT author (#PCDATA)>

]>

This DTD specifies that a "book" must contain "title" and "author" elements, both of which hold text

available
in
XML
Schema.
They
also
offer
limited
support
for
namespaces
and
are
less
suitable
for
complex
document
structures.
Despite
these
limitations,
DTDs
remain
popular
due
to
their
simplicity
and
effectiveness
for
basic
validation
tasks.
content.