blob: f5d45f719c5cafbf150850da56a54a2460ba8834 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<!--Arbortext, Inc., 1988-2005, v.4002-->
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
"task.dtd">
<?Pub Inc?>
<task id="taddcmod" xml:lang="en-us">
<title>Adding content models</title>
<titlealts>
<searchtitle>Adding content models</searchtitle>
</titlealts>
<shortdesc>A content model is the representation of any data that can be contained
inside an element, global element, complex type, or group. It is a formal
description of the structure and permissible content of an element, global
element, complex type, or group, which may be used to validate a document
instance.</shortdesc>
<prolog><metadata>
<keywords><indexterm>XML schema editor<indexterm>content models</indexterm></indexterm>
<indexterm>XML schema files<indexterm>content models</indexterm></indexterm>
</keywords>
</metadata></prolog>
<taskbody>
<context><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 can 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 can appear more than once.</li>
</ul></p><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 an element, global element, complex type, or group, follow these
steps:</p></context>
<steps>
<step><cmd>In the Design view, select your complex type, or group:</cmd>
<choices>
<choice>If you selected a complex type, you can right-click it and click <uicontrol>Add
Sequence</uicontrol>, or <uicontrol>Add Choice</uicontrol> to add the type
of content model you want to your complex type. If you wish to use the <uicontrol>all</uicontrol> content
model, you can change the model by clicking the model in the Design view,
and in properties, select <uicontrol>all</uicontrol> as the <uicontrol>Kind</uicontrol>.
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.</choice>
<choice>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 <uicontrol>choice</uicontrol> or <uicontrol>all</uicontrol> content
model by selecting these options from the <uicontrol>Kind</uicontrol> menu.</choice>
</choices>
</step>
<step><cmd>(Optional) Select the appropriate value in the <uicontrol>MinOccurs</uicontrol> field.</cmd>
<info>This is the minimum number of times the content model must appear. If
you want the content model to be optional, select <uicontrol>0</uicontrol>.
Otherwise, select <uicontrol>1</uicontrol>. </info></step>
<step><cmd>(Optional) Select the appropriate value in the <uicontrol>MaxOccurs</uicontrol> field.</cmd>
<info>This is the maximum number of times a content model can appear. You
can select <uicontrol>unbounded</uicontrol> to indicate there is no maximum
number of occurrences.</info></step>
<step><cmd>Click the <uicontrol>Documentation</uicontrol> tab if you want
to provide any information about this content model.</cmd><info>The <uicontrol>Documentation</uicontrol> page
is used for human readable material, such as a description.</info>
</step>
<step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
add application information elements to your annotations of schema components.</cmd>
<info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
schema and add XML content to your annotations.</info></step>
</steps>
<postreq><p>You can add the following items 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 <codeph>any</codeph> element. You can use an <codeph>any</codeph> element
to extend your content model by any elements belonging to a specified namespace.</li>
</ul></postreq>
</taskbody>
</task>
<?Pub *0000005317?>