| <?xml version="1.0" encoding="UTF-8"?> |
| <!DOCTYPE html |
| PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html> |
| <head> |
| <!-- /******************************************************************************* |
| * Copyright (c) 2000, 2005 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ --> |
| <link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" /> |
| <title>Editing DTDs</title> |
| </head> |
| <body id="tedtdtd"><a name="tedtdtd"><!-- --></a> |
| |
| <h1 class="topictitle1">Editing DTDs</h1> |
| <div><p>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.</p><div class="skipspace"><p>You can edit DTDs in the following ways:</p> |
| <ul><li>Create or remove elements, attributes, entities, notations, and comments</li> |
| <li>Edit an element's content model</li> |
| <li>Edit a group</li> |
| <li>Reuse entities</li> |
| </ul> |
| <p><b>Editing in the Outline view</b></p> |
| <p>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. </p> |
| <p>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:</p> |
| </div> |
| <ol><li class="skipspace"><span>Create a new DTD or double-click an existing DTD in the Navigator |
| view.</span> It will automatically open in the DTD editor.</li> |
| <li class="skipspace"><span>In the Outline view, right-click the DTD <img src="../images/nDTDFile.gif" alt="Image of the DTD file" /> and select the node you want to add to it.</span></li> |
| <li class="skipspace"><span>In the Properties view, edit the fields for the node as appropriate.</span></li> |
| </ol> |
| <div class="skipspace"><p>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.</p> |
| <p><b>Editing |
| in the Source view</b></p> |
| <p> You can edit the source code for your DTD in |
| the Source view manually.</p> |
| <p>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:</p> |
| <ol><li>Create a new DTD or double-click an existing DTD in the Navigator view. |
| It will automatically open in the DTD editor.</li> |
| <li>Select the source code you want to edit - you can edit existing nodes |
| or create new ones.</li> |
| <li>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.</li> |
| <li>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.</li> |
| </ol> |
| <p><b>Sorting nodes in the Outline view</b></p> |
| <p>By default, DTD nodes |
| appear in the Outline view in the order you added them to the DTD. </p> |
| <p>If |
| you want to sort the DTD nodes alphabetically, click the <span class="uicontrol">Sort |
| items alphabetically</span> button <img src="../images/sort.gif" />. </p> |
| <p>You |
| can also group the DTD nodes into logical groups - notations, entities, elements, |
| and other. Click the <span class="uicontrol">Group items logically</span> button <img src="../images/organize_dtd_logically.gif" /> to sort the DTD nodes into logical |
| groups.</p> |
| <p>The following links contain information on how you can edit |
| DTD files:</p> |
| </div> |
| </div> |
| |
| <div> |
| <blockquote> |
| <div class="ulchildlink"><b><a href="../topics/tcretelm.html">Creating elements</a></b><br /> |
| You can use element declarations in DTDs to define the elements that may occur in an XML document. Element declarations can specify that an element can contain other elements, that it can contain anything at all, or that it must be empty.</div> |
| <div class="ulchildlink"><b><a href="../topics/tcretent.html">Creating entities</a></b><br /> |
| An entity is a shortcut used to represent complex strings or symbols that would otherwise be impossible, difficult or repetitive to include by hand.</div> |
| <div class="ulchildlink"><b><a href="../topics/tcretnot.html">Creating notations</a></b><br /> |
| Notations are means of associating a binary description with an entity or attribute. The most common uses of notations are to include familiar types of binary references, such as GIFs and JPGs, in an XML file.</div> |
| <div class="ulchildlink"><b><a href="../topics/tcretcomm.html">Creating a comment</a></b><br /> |
| Comments can be used to provide information about a document, such as the author's name, or the date it was last modified. Comments are visible to anyone reading the DTD, but are ignored by the XML parser.</div> |
| <div class="ulchildlink"><b><a href="../topics/tremvelm.html">Deleting elements, attributes, entities, notations, and comments</a></b><br /> |
| If you have created elements, attributes, entities, notations, and comments you no longer need, you can delete any of them.</div> |
| </blockquote> |
| <p><b class="relconceptshd">Related concepts</b><br /> |
| <a href="../topics/cdtdedit.html" title="After you have created or imported a DTD, you can open it in the DTD editor (by double-clicking it in the Navigator view), a tool for viewing and editing DTDs. You can use the DTD editor to perform a variety of tasks such as creating, editing, and deleting DTD elements, attributes, entities, notations, and comments">DTD editor</a><br /> |
| <a href="../topics/cdtdover.html" title="A document type definition (DTD) provides you with the means to validate XML files against a set of rules. When you create a DTD file, you can specify rules that control the structure of any XML files that reference the DTD file.">Document type definitions (DTDs) - overview</a><br /> |
| </p> |
| <p><b class="reltaskshd">Related tasks</b><br /> |
| <a href="../topics/tcretdtd.html" title="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.">Creating DTDs</a><br /> |
| <a href="../topics/timptdtd.html" title="If you want to work with DTD files that you created outside of the product, you can import them into the workbench and open them in the DTD editor. The DTD editor provides you with a structured view of the DTD.">Importing DTDs</a><br /> |
| </p> |
| <p><b class="relrefhd">Related reference</b><br /> |
| <a href="../topics/rrefint.html" title="The DTD editor has a built-in mechanism to handle referential integrity issues. When you delete or rename certain nodes, clean up for any nodes affected will automatically occur.">Referential integrity in the DTD editor</a><br /> |
| </p> |
| </div> |
| </body> |
| </html> |