blob: 29d6b7b6be2e8b2c3abbfc5308783503c48aa9cb [file] [log] [blame]
kpriceef160682006-08-29 18:08:31 +00001<?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">
2<html lang="en-us" xml:lang="en-us">
syeshinbefd53e2005-07-27 18:16:40 +00003<head>
kpriceef160682006-08-29 18:08:31 +00004<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
kpriceb59c9f62008-04-02 21:24:37 +00005<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" />
6<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
kpriceef160682006-08-29 18:08:31 +00007<meta content="public" name="security" />
8<meta content="index,follow" name="Robots" />
9<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))' />
10<meta content="task" name="DC.Type" />
11<meta name="DC.Title" content="Generating XML files from DTDs" />
12<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." />
13<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." />
kpriceb59c9f62008-04-02 21:24:37 +000014<meta content="XML files, generating from DTDs, DTD, generating XML files" name="DC.subject" />
15<meta content="XML files, generating from DTDs, DTD, generating XML files" name="keywords" />
kpriceef160682006-08-29 18:08:31 +000016<meta scheme="URI" name="DC.Relation" content="../topics/tcretxml.html" />
17<meta scheme="URI" name="DC.Relation" content="../topics/tcrexxsd.html" />
18<meta scheme="URI" name="DC.Relation" content="../topics/txedttag.html" />
19<meta scheme="URI" name="DC.Relation" content="../topics/cwxmledt.html" />
20<meta content="XHTML" name="DC.Format" />
21<meta content="tcrexdtd" name="DC.Identifier" />
22<meta content="en-us" name="DC.Language" />
23<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
syeshinbefd53e2005-07-27 18:16:40 +000024<title>Generate an XML file from a DTD</title>
syeshin66078272005-09-20 16:53:38 +000025</head>
syeshinbefd53e2005-07-27 18:16:40 +000026<body id="tcrexdtd"><a name="tcrexdtd"><!-- --></a>
27
kpriceef160682006-08-29 18:08:31 +000028
syeshind0bdb8e2005-10-27 17:44:14 +000029<h1 class="topictitle1">Generating XML files from DTDs</h1>
kpriceef160682006-08-29 18:08:31 +000030
31
32
33
syeshind0bdb8e2005-10-27 17:44:14 +000034<div><p>You can generate an XML file from your DTD if you want to quickly
35create an XML file based on your DTD file. Generating an XML file from your
36DTD saves you time by creating an XML file that is already associated with
37your DTD, and contains at least some of the elements and attributes in your
38DTD.</p>
kpriceef160682006-08-29 18:08:31 +000039
syeshind0bdb8e2005-10-27 17:44:14 +000040<div class="section"><p>After you have generated your XML file, you can further customize
41it in the XML editor.</p>
kpriceef160682006-08-29 18:08:31 +000042<p>The following instructions were written for the
43Resource perspective, but they will also work in many other perspectives.</p>
syeshinbefd53e2005-07-27 18:16:40 +000044<p>To
kpriceb59c9f62008-04-02 21:24:37 +000045create an XML file from a DTD file, complete the following steps:</p>
syeshinbefd53e2005-07-27 18:16:40 +000046</div>
kpriceef160682006-08-29 18:08:31 +000047
48<ol>
49<li class="stepexpand"><span>In the Navigator view, right-click the DTD file that you want to
kpriceb59c9f62008-04-02 21:24:37 +000050work with and select <span class="menucascade"><span class="uicontrol">Generate</span> &gt; <span class="uicontrol">XML
51File</span></span>.</span></li>
kpriceef160682006-08-29 18:08:31 +000052
53<li class="stepexpand"><span>Select a project or folder to contain the XML file and type a name
kpriceb59c9f62008-04-02 21:24:37 +000054for the file in the <span class="uicontrol">File Name</span> field, then click <span class="uicontrol">Next</span>.</span>
55 The name of the file must end in <kbd class="userinput">.xml</kbd>.
kpriceef160682006-08-29 18:08:31 +000056</li>
57
kpriceef160682006-08-29 18:08:31 +000058<li class="stepexpand"><span>Select the <span class="uicontrol">Root element</span> of the XML file.</span>
59 The root element of an XML file is the element that contains all other
syeshinbefd53e2005-07-27 18:16:40 +000060elements in that file. All the elements that you have defined in the DTD will
kpriceef160682006-08-29 18:08:31 +000061be shown in the <span class="uicontrol">Root element</span> list.</li>
62
63<li class="stepexpand"><span>Select from the following content options: </span>
64<ul>
kpriceb59c9f62008-04-02 21:24:37 +000065<li><span class="uicontrol">Create optional attributes</span>: both mandatory
kpriceef160682006-08-29 18:08:31 +000066and optional attributes will be generated.</li>
67
kpriceb59c9f62008-04-02 21:24:37 +000068<li><span class="uicontrol">Create optional elements</span>: both mandatory and
kpriceef160682006-08-29 18:08:31 +000069optional elements will be generated.</li>
70
kpriceb59c9f62008-04-02 21:24:37 +000071<li><span class="uicontrol">Create first choice of required choice</span>: the
kpriceef160682006-08-29 18:08:31 +000072first option of a required choice will be generated in your XML file.</li>
73
kpriceb59c9f62008-04-02 21:24:37 +000074<li><span class="uicontrol">Fill elements and attributes with data</span>:
75any elements and attributes generated will be filled with sample data.</li>
kpriceef160682006-08-29 18:08:31 +000076
syeshinbefd53e2005-07-27 18:16:40 +000077</ul>
kpriceef160682006-08-29 18:08:31 +000078
kpriceb59c9f62008-04-02 21:24:37 +000079 If you do not select any of these options, then only the minimum amount
80of content required for the XML file will be created.</li>
kpriceef160682006-08-29 18:08:31 +000081
82<li class="stepexpand"><span>Specify the <span class="uicontrol">Public ID</span> or <span class="uicontrol">System
83ID</span>.</span> You do not need to specify both. If you do, the
84Public ID will be used before the System ID. </li>
85
86<li class="stepexpand"><span>Click <span class="uicontrol">Finish</span>.</span></li>
87
syeshinbefd53e2005-07-27 18:16:40 +000088</ol>
kpriceef160682006-08-29 18:08:31 +000089
90<div class="section"><p>The XML file will only contain the selected root element and any
91elements or attributes contained in the root element. You can now add elements,
92attributes, entities, and notations to the XML file, however, they must follow
93the rules established in the DTD that you used to create the XML file.</p>
94</div>
95
96</div>
97
98<div><div class="relconcepts"><strong>Related concepts</strong><br />
99<div><a href="../topics/cwxmledt.html" title="The XML editor is a tool for creating and viewing XML files.">XML editor</a></div>
100</div>
101<div class="reltasks"><strong>Related tasks</strong><br />
kprice0d617d02007-04-05 04:02:49 +0000102<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>
kpriceef160682006-08-29 18:08:31 +0000103<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>
104<div><a href="../topics/txedttag.html" title="This file contains information about editing XML files.">Editing XML files</a></div>
syeshinbefd53e2005-07-27 18:16:40 +0000105</div>
106</div>
107
syeshinbefd53e2005-07-27 18:16:40 +0000108</body>
109</html>