Search code examples
xmlxsddtdxsd-validationxml-validation

Why DTD is not extensible?


I know that a language is extensible if it allows users to create any tags needed and then describing those tags and their permitted uses.

If I'm not wrong, in this example

code:

<!ELEMENT people_list (person)*>
<!ELEMENT person (name, birthdate?, gender?, socialsecuritynumber?)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT birthdate (#PCDATA)>
<!ELEMENT gender (#PCDATA)>
<!ELEMENT socialsecuritynumber (#PCDATA)>

The DTD is defining an element (tag) called person, another element called name etc...

So, why this is not extensible as XSD?


Solution

  • Background: DTD exists to support the extensibility of XML. Instead of a fixed markup language, XML allows you to define your own vocabulary and grammar via a schema such as DTD.

    Why DTD is not extensible?

    DTD is extensible.

    • DTDs can be extended via various techniques. Examples include repeating ATTLIST to add attributes and redefining parameter ENTITIES.
    • There's a long history of clever DTD extensibility applied to substantial projects. Examples:

    So, why this is not extensible as XSD?

    Because DTD predates XSD, and progress occurs.

    See also