blob: 51174827c3ddd18983d68200584f59f5ec7dd67a [file] [log] [blame]
<?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>
<link rel="stylesheet" type="text/css" href="../org.eclipse.wst.doc.user/common.css" />
<title>Creating a new document type definition (DTD)</title>
</head>
<body id="tcretdtd"><a name="tcretdtd"><!-- --></a>
<h1 class="topictitle1">Creating DTDs</h1>
<div><p>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.</p><div class="skipspace"><p></p>
<p>The following instructions were written for the Resource
perspective, but they will also work in many other perspectives. </p>
<p>Follow
these steps to create a new DTD:</p>
</div>
<ol><li class="skipspace"><span>If necessary, create a project to contain the DTD.</span></li>
<li class="skipspace"><span>In the workbench, select <span class="menucascade"><span class="uicontrol">File</span> &gt; <span class="uicontrol">New</span> &gt; <span class="uicontrol">Other</span> &gt; <span class="uicontrol">XML</span> &gt; <span class="uicontrol"> DTD</span></span> and click <span class="uicontrol">Next</span></span> If you cannot see the <span class="uicontrol">XML</span> option, select the <span class="uicontrol">Show
All Wizards</span> check box. </li>
<li class="skipspace"><span>If you are prompted to enable XML Development capabilities, click <span class="uicontrol">OK</span>.</span></li>
<li class="skipspace"><span>Select the project or folder that will contain the DTD.</span></li>
<li class="skipspace"><span>In the <span class="uicontrol">File name</span> field, type the name of
the DTD, for example <kbd class="userinput">MyDTD.dtd</kbd>.</span> The
name of your DTD file must end with the extension <kbd class="userinput">.dtd</kbd></li>
<li class="skipspace"><span>Click <span class="uicontrol">Finish</span>.</span></li>
</ol>
<div class="skipspace"><p>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.</p>
</div>
</div>
<div><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/tedtdtd.html" title="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.">Editing DTDs</a><br />
<a href="../topics/tgenxmls.html" title="Generating an XML schema from a DTD file enables you to create an XML schema that is automatically populated with elements and attributes from your DTD file. This can save you time if you want to use an XML schema rather than a DTD file to validate your XML file, but you want to use the rules already set up in your DTD file.">Generating XML schemas from DTD files</a><br />
</p>
</div>
<p>
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.
</p>
</body>
</html>