Although a DTD helps create structures in XML documents, it has limitations as shown in the following table.
Limitation
|
Description
|
No data validation |
A DTD defines the structure
for placing the elements, but does not specify what each element
should contain. For example, you can specify that the Message element
can contain the number element. However, you cannot specify that
a number element should contain both a priority element and numeric
content.
|
Global scope for all
definitions |
The definitions in the
DTD have a global scope and there is no way to limit the scope of
a definition. For example, consider that an XML document contains
library information. You have described a name element within the
scope of a book element. A DTD will not allow you to describe a
different structure for the name element under the member element. |
No data typing |
There is no way to specify
the type of text that can occur where PCDATA has been defined in
a DTD. PCDATA permits both numeric and character content. For example,
a DTD cannot restrict an element to contain only numeric content. |
Namespace resolution |
A DTD does not optimally support namespaces, in particular, when it is
used to describe the structure of large XML documents that make
extensive use of namespaces. |
|