tdtd Emacs Mode for DTDs

The tdtd package for an Emacs major mode for editing SGML and XML DTDs is available in at Installation instructions are included in the file readme.txt in the tdtd distribution.

Do not bookmark anything about tdtd other than this page since this web site is still a work in progress and filenames and directories may still change.

A tutorial on using tdtd is available at

The current revision is 0.7.1 dated March 24, 1999.

Features of tdtd revision 0.7.1 include:

  • Standalone mode for editing DTDs;
  • "Goto" menu for locating declarations within the current buffer;
  • dtd-etags function for creating Emacs TAGS files for easy lookup of any element, parameter entity, or notation's definition using Emacs's built-in tag-lookup functions;
  • dtd-grep function for searching files that shares a file history with dtd-etags for easy searching of the same files with both functions;
  • Specific font lock highlighting of declarations in XML DTDs, SGML DTDs, SGML Declarations, and System Declarations so that the important information stands out;
  • XML-specific behaviour that, at user option, is triggered by automatic detection of the XML Declaration;
  • Functions for writing and editing element, attribute, internal parameter entity and external parameter entity declarations and comments to ease creating and keeping a consistent style; and
  • Elements and parameter entity names referenced in declarations are stored in minibuffer history to minimise retyping in new declarations.

dtd-mode references sgml-validate for its validation function. Use with Lennart Staflin's psgml package is recommended.

Use with resize-minibuffer-mode is also recommended.

The "Goto" menu is only available if you have imenu.el.

dtd-mode was tested using NTEmacs 19.34.1 and NTEmacs 20.3.1.


You can check out the latest (and possibly unstable) code using:

git clone

Before you either use or install tdtd, you will have to make tdtd-font.el as described in readme.txt.


tdtd has been available for Ubuntu (and, presumably, Debian) as the tdtd package.