# Creating DTDs

A document type definition (DTD) contains a set of rules that can be used to validate an XML file. After you have created a DTD, you can edit it, adding declarations that define elements, attributes, entities, and notations, and how they can be used for any XML files that reference the DTD file.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

Follow these steps to create a new DTD:

1. If necessary, create a project to contain the DTD.
2. In the workbench, select File > New > Other > XML > DTD and click Next. If you cannot see the XML option, select the Show All Wizards check box.
3. If you are prompted to enable XML Development capabilities, click OK.
4. Select the project or folder that will contain the DTD.
5. In the File name field, type the name of the DTD, for example `MyDTD.dtd`. The name of your DTD file must end with the extension `.dtd`
6. Click Finish.

The DTD appears in the Navigator view and automatically, by default, opens in the DTD editor. In the DTD editor, you can add elements, attributes, notations, entities, and comments to the DTD. If you close the file, and want to later re-open it in the DTD editor, double-click it in the Navigator view.

Related concepts
DTD editor
Document type definitions (DTDs) - overview

Related tasks
Editing DTDs
Generating XML schemas from DTD files

(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.