Editing DTDs

You can edit DTD files in both the Outline view and the Source view. Modifying the content of a DTD determines what can be used in any XML file that is associated with it.

You can edit DTDs in the following ways:

Editing in the Outline view

The Outline view will show you all the items in your DTD as you add them. In this view, you can both create and delete DTD nodes. 

The following instructions were written for the Resource perspective, but they will also work in many other perspectives. To edit a DTD in the Outline view, follow these steps:

  1. Create a new DTD or double-click an existing DTD in the Navigator view. It will automatically open in the DTD editor.
  2. In the Outline view, right-click the DTD This graphic is the DTD icon. and select the node you want to add to it.
  3. In the Properties view, edit the fields for the node as appropriate.

The DTD editor has a built-in mechanism to handle referential integrity issues. When you delete or edit certain components, clean up will automatically occur. Refer to the related reference section for more information.

Editing in the Source view

You can edit the source code for your DTD in the Source view manually.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives. To edit a DTD in the Source view, follow these steps:

  1. Create a new DTD or double-click an existing DTD in the Navigator view. It will automatically open in the DTD editor.
  2. Select the source code you want to edit - you can edit existing nodes or create new ones.
  3. Your changes to the DTD will automatically be reflected in the Outline and Properties views. If you have created any errors in your code while editing in the Source view, they will appear in the Problems view when you save or validate the file.
  4. The DTD editor has a built-in mechanism to handle referential integrity issues, however, this mechanism only works if you delete items using the Outline view or edit them in the Properties view. If you delete or edit items using the Source view, clean up will not automatically occur; instead you will receive error messages in the Problems view if you validate or save the file.

Sorting nodes in the Outline view

By default, DTD nodes appear in the Outline view in the order you added them to the DTD. 

If you want to sort the DTD nodes alphabetically, click the Sort items alphabetically button This graphic is the Sort items alphabetically button.

You can also group the DTD nodes into logical groups - notations, entities, elements, and other. Click the Group items logically button This graphic is the Group items logically button. to sort the DTD nodes into logical groups.

The following links contain information on how you can edit DTD files:

Related concepts
DTD editor
Document type definitions (DTDs) - overview
Related tasks
Creating DTDs
Importing DTDs
Related reference
Referential integrity in the DTD editor

Feedback