blob: e1efde51cb1a8b9f2b89460ddb17d1e6231d812d [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--Arbortext, Inc., 1988-2006, v.4002-->
<task id="tcrexdtd" xml:lang="en-us">
<title>Generating XML files from DTDs</title>
<searchtitle>Generate an XML file from a DTD</searchtitle>
<shortdesc>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
<keywords><indexterm keyref="tcrexdtd|1|XMLfilesgeneratingfromDTDs" status="new">XML
files<indexterm>generating from DTDs</indexterm></indexterm><indexterm keyref="tcrexdtd|2|DTDgeneratingXMLfiles"
status="changed">DTDs<indexterm>generating XML files</indexterm></indexterm>
<context><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></context>
<step><cmd>In the Navigator view, right-click the DTD file that you want to
work with and select <menucascade><uicontrol>Generate</uicontrol><uicontrol>XML
<step><cmd>Select a project or folder to contain the XML file and type a name
for the file in the <uicontrol>File Name</uicontrol> field, then click <uicontrol>Next</uicontrol>.</cmd>
<info>The name of the file must end in <userinput>.xml</userinput>.</info>
<step><cmd>Select the <uicontrol>Root element</uicontrol> of the XML file.</cmd>
<info>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 <uicontrol>Root element</uicontrol> list.</info></step>
<step><cmd>Select from the following content options: </cmd>
<choice><uicontrol>Create optional attributes</uicontrol>: both mandatory
and optional attributes will be generated.</choice>
<choice><uicontrol>Create optional elements</uicontrol>: both mandatory and
optional elements will be generated.</choice>
<choice><uicontrol>Create first choice of required choice</uicontrol>: the
first option of a required choice will be generated in your XML file.</choice>
<choice><uicontrol>Fill elements and attributes with data</uicontrol>: any
elements and attributes generated will be filled with sample data.</choice>
<info> If you do not select any of these options, then only the minimum amount
of content required for the XML file will be created.</info></step>
<step><cmd>Specify the <uicontrol>Public ID</uicontrol> or <uicontrol>System
ID</uicontrol>.</cmd><info>You do not need to specify both. If you do, the
Public ID will be used before the System ID. </info></step>
<step><cmd>Click <uicontrol>Finish</uicontrol>.</cmd></step>
<result><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></result>