blob: 8e127ef5df709556ab7bb02ff310de0e4f2ec7a8 [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, 2009 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/. Contributors: IBM Corporation - initial API and implementation" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2009" />
<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="Generating XML files from DTDs" />
<meta name="abstract" content="You can generate an XML file from your DTD if you want to quickly create an XML file based on your DTD file. Generating an XML file from your DTD saves you time by creating an XML file that is already associated with your DTD, and contains at least some of the elements and attributes in your DTD." />
<meta name="description" content="You can generate an XML file from your DTD if you want to quickly create an XML file based on your DTD file. Generating an XML file from your DTD saves you time by creating an XML file that is already associated with your DTD, and contains at least some of the elements and attributes in your DTD." />
<meta content="XML files, generating from DTDs, DTDs, generating XML files" name="DC.subject" />
<meta content="XML files, generating from DTDs, DTDs, generating XML files" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="../topics/tcretxml.html" />
<meta scheme="URI" name="DC.Relation" content="../topics/tcrexxsd.html" />
<meta scheme="URI" name="DC.Relation" content="../topics/txedttag.html" />
<meta scheme="URI" name="DC.Relation" content="../topics/cwxmledt.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="tcrexdtd" 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>Generate an XML file from a DTD</title>
</head>
<body id="tcrexdtd"><a name="tcrexdtd"><!-- --></a>
<h1 class="topictitle1">Generating XML files from DTDs</h1>
<div><p>You can generate an XML file from your DTD if you want to quickly
create an XML file based on your DTD file. Generating an XML file from your
DTD saves you time by creating an XML file that is already associated with
your DTD, and contains at least some of the elements and attributes in your
DTD.</p>
<div class="section"><p>After you have generated your XML file, you can further customize
it in the XML editor.</p>
<p>The following instructions were written for the
Resource perspective, but they will also work in many other perspectives.</p>
<p>To
create an XML file from a DTD file, complete the following steps:</p>
</div>
<ol>
<li class="stepexpand"><span>In the Navigator view, right-click the DTD file that you want to
work with and select <span class="menucascade"><span class="uicontrol">Generate</span> &gt; <span class="uicontrol">XML
File</span></span>.</span></li>
<li class="stepexpand"><span>Select a project or folder to contain the XML file and type a name
for the file in the <span class="uicontrol">File Name</span> field, then click <span class="uicontrol">Next</span>.</span>
The name of the file must end in <kbd class="userinput">.xml</kbd>.
</li>
<li class="stepexpand"><span>Select the <span class="uicontrol">Root element</span> of the XML file.</span>
The root element of an XML file is the element that contains all other
elements in that file. All the elements that you have defined in the DTD will
be shown in the <span class="uicontrol">Root element</span> list.</li>
<li class="stepexpand"><span>Select from the following content options: </span>
<ul>
<li><span class="uicontrol">Create optional attributes</span>: both mandatory
and optional attributes will be generated.</li>
<li><span class="uicontrol">Create optional elements</span>: both mandatory and
optional elements will be generated.</li>
<li><span class="uicontrol">Create first choice of required choice</span>: the
first option of a required choice will be generated in your XML file.</li>
<li><span class="uicontrol">Fill elements and attributes with data</span>: any
elements and attributes generated will be filled with sample data.</li>
</ul>
If you do not select any of these options, then only the minimum amount
of content required for the XML file will be created.</li>
<li class="stepexpand"><span>Specify the <span class="uicontrol">Public ID</span> or <span class="uicontrol">System
ID</span>.</span> You do not need to specify both. If you do, the
Public ID will be used before the System ID. </li>
<li class="stepexpand"><span>Click <span class="uicontrol">Finish</span>.</span></li>
</ol>
<div class="section"><p>The XML file will only contain the selected root element and any
elements or attributes contained in the root element. You can now add elements,
attributes, entities, and notations to the XML file, however, they must follow
the rules established in the DTD that you used to create the XML file.</p>
</div>
</div>
<div><div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="../topics/cwxmledt.html" title="The XML editor is a tool for creating and viewing XML files.">XML editor</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="../topics/tcretxml.html" title="You can create a new XML file which you can then edit in the XML editor. You create a new XML file that is not associated with a DTD or XML schema file, so there are no restrictions on the kind of content it can contain.">Creating XML files</a></div>
<div><a href="../topics/tcrexxsd.html" title="You can generate an XML file from your XML schema if you want to quickly create an XML file based on your XML schema file. Generating an XML file from your XML schema saves you time by creating an XML file that is already associated with your XML schema, and contains at least some of the elements and attributes in your XML schema.">Generating XML files from XML schemas</a></div>
<div><a href="../topics/txedttag.html" title="This file contains information about editing XML files.">Editing XML files</a></div>
</div>
</div>
</body>
</html>