blob: 1670b555b0a0026ccce171d2d49af14fbbdca10b [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="../../com.ibm.help.doc/swg_info_common.css" />
<title>Creating elements</title>
<script language="JavaScript">
function popup_window( url, id, width, height )
{
popup = window.open( url, id, 'toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=no,width=' + width + ',height=' + height + ',left=,top=' );
popup.focus();
}
</script><script language="JavaScript" src="help/liveHelp.js"></script></head>
<body id="tcretelm"><a name="tcretelm"><!-- --></a>
<h1 class="topictitle1">Creating elements</h1>
<div><p>You can use element declarations in DTDs to define the elements
that may occur in an XML document. Element declarations can specify that an
element can contain other elements, that it can contain anything at all, or
that it must be empty.</p><div class="skipspace"><p>The following instructions were written for the Resource perspective,
but they will also work in many other perspectives. </p>
<p><b>Creating
elements</b></p>
<p>To create an element, follow these steps:</p>
</div>
<ol><li class="skipspace"><span>Open your DTD in the DTD editor.</span></li>
<li class="skipspace"><span>In the Outline view, right-click the DTD <img src="../images/nDTDFile.gif" alt="Image of the DTD icon" /> and click <span class="uicontrol">Add Element</span>.</span></li>
<li class="skipspace"><span>In the Properties view, type the new name of the element in the <span class="uicontrol">Name</span> field.</span></li>
<li class="skipspace"><span>When you create an element in the DTD editor, a child element that
is EMPTY is automatically created.</span><ol type="a"><li class="skipspace"><span>Select the EMPTY child element and, in the Properties view,
change its <span class="uicontrol">Content type</span> to ANY, (#PCDATA), or another
element.</span> If you do not want the parent element to contain anything,
leave its content model type as EMPTY. </li>
<li class="skipspace"><span>If you want your parent element to contain more than one child
element (or mixed content), select <span class="uicontrol">Children Content</span> or <span class="uicontrol">Mixed
Content</span> from the <span class="uicontrol">Content type</span> list.</span> Once you select either of these, you will have a group (represented
by a group node - <img src="../images/XSDSequence.gif" /> if you select
Children Content and <img src="../images/XSDChoice.gif" /> if you select
Mixed Content), which you can use to create a group of child elements under
the parent element. A child element will automatically be created under
the group node. For information on editing a group, refer to the related information.
</li>
</ol>
</li>
<li class="skipspace"><span>Click the <span class="uicontrol">Documentation</span> tab
if you want to provide any information about this element.</span> The <span class="uicontrol">Documentation</span> page
is used for human readable material, such as a description of the element.</li>
</ol>
<div class="skipspace"><p><b>Note</b>: If you intend to have mixed content, the value of
the first element in your group must be (#PCDATA) (consequently, if you select <span class="uicontrol">Mixed
Content</span>, two child elements will automatically be created, the
first one having a value of (#PCDATA)). As well, a group should not contain
an EMPTY or ANY element. EMPTY or ANY elements are not legally allowed as
nested entities.</p>
</div>
</div>
<div><p><b class="reltaskshd">Related tasks</b><br />
<a href="../topics/tcretattr.html" title="You can use an attribute to describe an element or provide information about it. Attribute lists enable you to group together all related attributes for an element.">Creating attributes and attribute lists</a><br />
<a href="../topics/tchgelm.html" title="An element's content model represents any data that can be contained inside or within the content of an element (that is, between the start and end tags of an element in an XML file). Editing an element's content model enables you to determine exactly what the element can (and cannot) contain.">Editing an element's content model</a><br />
<a href="../topics/tedtgnde.html" title="If your element has either element content or mixed content, its content model is represented by a group node. You can add children elements or another group to a group node, and specify how often, and in what manner a group of elements will be available in an XML file associated with your DTD.">Editing a group node</a><br />
<a href="../topics/tremvelm.html" title="If you have created elements, attributes, entities, notations, and comments you no longer need, you can delete any of them.">Deleting elements, attributes, entities, notations, and comments</a><br />
</p>
</div>
<p>
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.
</p>
</body>
</html>