What is XML markup for?

16. The Doctype Declaration

You may sometimes find an optional "Document Type" declaration:

<?xml version="1.0" ?> <!DOCTYPE greeting SYSTEM "greeting.dtd []">
  • The DTD is one way of associating the document with its schema (but is not used by W3C or RELAXNG for this purpose)
  • The DTD subset is used to provide declarations additional to those in the schema, for example for external files
  • The DTD subset may be internal, external, or both

DTDs are now considered old-fashioned — RELAXNG or W3C schemas are preferred.

Up: Contents Previous: 15. Namespace declarations Next: 17. XML syntax: the small print