blob: 3bb693207bd565c16c1ceb5e360712ce9715086a [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 lang="en-us" xml:lang="en-us">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2008 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" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Creating DTDs" />
<meta name="abstract" content="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 manually, adding declarations that define elements, attributes, entities, and notations, and how they can be used for any XML files that reference the DTD file." />
<meta name="description" content="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 manually, adding declarations that define elements, attributes, entities, and notations, and how they can be used for any XML files that reference the DTD file." />
<meta content="DTDs, creating" name="DC.subject" />
<meta content="DTDs, creating" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="../topics/cdtdover.html" />
<meta scheme="URI" name="DC.Relation" content="../topics/tdtemplt.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="tcretdtd" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<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 manually, 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="section"><p>The following instructions were written for the Resource perspective,
but they will also work in many other perspectives.</p>
<p>To create a new
DTD, complete the following steps:</p>
</div>
<ol>
<li class="stepexpand"><span>Create a project to contain the DTD if needed.</span></li>
<li class="stepexpand"><span>In the workbench, click <span class="menucascade"><span class="uicontrol">File</span>
&gt; <span class="uicontrol">New</span> &gt; <span class="uicontrol">Other</span></span> and select <span class="menucascade">
<span class="uicontrol">XML</span> &gt; <span class="uicontrol"> DTD</span></span>. Click <span class="uicontrol">Next</span>. </span>
</li>
<li class="stepexpand"><span>Select the project or folder that will contain the DTD.</span></li>
<li class="stepexpand"><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="stepexpand"><span>Click <span class="uicontrol">Next</span>.</span></li>
<li class="stepexpand"><strong>Optional: </strong><span>You can use a DTD template as the basis for
your new DTD file. To do so, click the <span class="uicontrol">Use DTD Template</span> check
box, and select the template you want to use.</span></li>
<li class="stepexpand"><span>Click <span class="uicontrol">Finish</span>.</span></li>
</ol>
<div class="section"><p>The DTD appears in the Navigator view and automatically, by default,
opens in the DTD editor. In the DTD editor, you can manually 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><div class="relconcepts"><strong>Related concepts</strong><br />
<div><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></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="../topics/tdtemplt.html" title="Templates are a chunk of predefined code that you can insert into a DTD file when it is created. You may find a template useful when you have a certain piece of code you want to reuse several times, and you do not want to write it out every time.">Working with DTD templates</a></div>
</div>
</div>
</body>
</html>