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.
About this task
You
can edit DTDs in the following ways:
- Create or remove elements,
attributes, entities, notations, and comments
- Edit an element's
content model
- Edit a group
- Reuse entities
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:
Procedure
- Create a new DTD or double-click an existing DTD
in the Navigator
view. It will automatically open in the DTD editor.
- In the Outline view, right-click the DTD
and
select the node you want to add to it.
- In the
Properties view, edit the fields for the node as appropriate.
Results
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:
- Create
a new DTD or double-click an existing DTD in the Navigator view.
It will automatically open in the DTD editor.
- Select the source
code you want to edit - you can edit existing nodes
or create new ones.
- 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.
- 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
.
You
can also group the DTD nodes into logical groups - notations, entities,
elements,
and other. Click 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: