| <?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>Adding a content model</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="taddcmod"><a name="taddcmod"><!-- --></a> |
| |
| <h1 class="topictitle1">Adding a content model</h1> |
| <div><p>You can add a content model to an element, global element, a complex |
| type, or a group. A content model is the representation of any data that may |
| be contained inside the element, global element, complex type, or group.</p><div class="skipspace"><div class="p">There are three different kinds of content models:<ul><li><b>Sequence</b>, which means that all the content model's children can |
| appear in an instance of the XML schema. They must, however, appear in the |
| order they are listed in the content model.</li> |
| <li><b>Choice</b>, which means that only one of the content model's children |
| can appear in an instance of the XML schema.</li> |
| <li><b>All</b>, which means that all of the content model's children can appear |
| once or not at all, and they may appear in any order. If you select this option, |
| all of the contents model's children must be individual elements and no element |
| in the content model may appear more than once</li> |
| </ul> |
| </div> |
| <p>The following instructions were written for the Resource perspective, |
| but they will also work in many other perspectives. </p> |
| <p>To add a content |
| model, to a global element, complex type, or group, follow these steps:</p> |
| </div> |
| <ol><li class="skipspace"><span>In the Outline view, select your global element, complex type, |
| or group:</span><ul><li>If you selected an element or global element, you can right-click |
| it and click <span class="uicontrol">Add Sequence</span>, <span class="uicontrol">Add Choice</span>, |
| or <span class="uicontrol">Add All</span> to add the type of content model you want |
| to your element or global element. Your content model is automatically added |
| as a child of a local complex type - expand your element or global element |
| in the Outline view to see it.</li> |
| <li>If you selected a complex type, you can right-click it and click <span class="uicontrol">Add |
| Sequence</span>, <span class="uicontrol">Add Choice</span>, or <span class="uicontrol">Add |
| All</span> to add the type of content model you want to your complex |
| type. Your content model is automatically added as a child of your complex |
| type - expand in the Outline view to see it. <b>Note:</b>These |
| options will not appear if you have set a base type for your complex type. |
| You can either set a base type for your complex type, or you add a content |
| model to it, but you cannot do both.</li> |
| <li>Your group is automatically created with a sequence content model |
| child. Expand it in the Outline view to see it and select it. In the Properties |
| view, you can select to change it to a <span class="uicontrol">choice</span> or <span class="uicontrol">all</span> content |
| model by selecting these options from the <span class="uicontrol">Kind</span> drop |
| down list.</li> |
| </ul> |
| </li> |
| <li class="skipspace"><span>(Optional) Select the appropriate value in the <span class="uicontrol">MinOccurs</span> field.</span> This is the number of times the content model must appear. If you want |
| the content model to be optional, select <span class="uicontrol">0</span>. Otherwise, |
| select <span class="uicontrol">1</span>. </li> |
| <li class="skipspace"><span>(Optional) Select the appropriate value in the <span class="uicontrol">MaxOccurs</span> field.</span> This is the maximum number of times a content model may appear. You |
| can select <span class="uicontrol">unbounded</span> to indicate there is no maximum |
| number of occurrences.</li> |
| <li class="skipspace"><span>Click the <span class="uicontrol">Documentation</span> tab if you want |
| to provide any information about this content model.</span> The <span class="uicontrol">Documentation</span> page |
| is used for human readable material, such as a description, and the <span class="uicontrol">App |
| Info</span> page can be used to provide information for applications. </li> |
| </ol> |
| <div class="skipspace"><p>You can add the following to a content object model. </p> |
| <ul><li>Another content model.</li> |
| <li>A group reference which enables the referenced group to appear in the |
| instance document in the context of the referencing declaration. This |
| menu option only appears if there are global groups defined elsewhere in the |
| document or if groups are defined in included schemas.</li> |
| <li>An element, fundamental building blocks in XML.</li> |
| <li>An element reference, which provides a reference to a global element. |
| This menu option only appears if there are global elements defined elsewhere |
| in the document.</li> |
| <li>An <samp class="codeph">any</samp> element. You can use an <samp class="codeph">any</samp> element |
| to extend your content model by any elements belonging to a specified namespace.</li> |
| </ul> |
| </div> |
| </div> |
| <p> |
| (C) Copyright IBM Corporation 2000, 2005. All Rights Reserved. |
| </p> |
| </body> |
| </html> |