blob: 7f69dda4c79bd008edb6a807db2e2d4c5ea5bbd4 [file] [log] [blame]
kprice159fa582006-05-08 21:30:45 +00001<?xml version="1.0" encoding="utf-8"?>
kpricede20a692008-04-24 00:27:47 +00002<!--Arbortext, Inc., 1988-2006, v.4002-->
kprice647b7352006-05-17 21:27:16 +00003<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN"
4 "task.dtd">
5<?Pub Inc?>
kprice159fa582006-05-08 21:30:45 +00006<task id="taddcmod" xml:lang="en-us">
7<title>Adding content models</title>
9<searchtitle>Adding content models</searchtitle>
11<shortdesc>A content model is the representation of any data that can be contained
12inside an element, global element, complex type, or group. It is a formal
13description of the structure and permissible content of an element, global
14element, complex type, or group, which may be used to validate a document
kprice9623e9d2007-05-03 03:43:05 +000017<keywords><indexterm>XML schema editor<indexterm>content models</indexterm></indexterm>
18<indexterm>XML schema files<indexterm>content models</indexterm></indexterm>
kprice159fa582006-05-08 21:30:45 +000019</keywords>
22<context><p>There are three different kinds of content models:<ul>
23<li><b>Sequence</b>, which means that all the content model's children can
24appear in an instance of the XML schema. They must, however, appear in the
25order they are listed in the content model.</li>
26<li><b>Choice</b>, which means that only one of the content model's children
27can appear in an instance of the XML schema.</li>
28<li><b>All</b>, which means that all of the content model's children can appear
29once or not at all, and they can appear in any order. If you select this option,
30all of the contents model's children must be individual elements and no element
31in the content model can appear more than once.</li>
32</ul></p><p>The following instructions were written for the Resource perspective,
33but they will also work in many other perspectives.</p><p>To add a content
kpricede20a692008-04-24 00:27:47 +000034model to an element, global element, complex type, or group, complete the
35following steps:</p></context>
kprice159fa582006-05-08 21:30:45 +000036<steps>
kprice647b7352006-05-17 21:27:16 +000037<step><cmd>In the Design view, select your complex type, or group:</cmd>
kprice159fa582006-05-08 21:30:45 +000038<choices>
39<choice>If you selected a complex type, you can right-click it and click <uicontrol>Add
40Sequence</uicontrol>, or <uicontrol>Add Choice</uicontrol> to add the type
41of content model you want to your complex type. If you wish to use the <uicontrol>all</uicontrol> content
kprice647b7352006-05-17 21:27:16 +000042model, you can change the model by clicking the model in the Design view,
43and in properties, select <uicontrol>all</uicontrol> as the <uicontrol>Kind</uicontrol>.
kprice159fa582006-05-08 21:30:45 +000044Your content model is automatically added as a child of your complex type
45- expand in the Outline view to see it. <b>Note:</b> These options will not
46appear if you have set a base type for your complex type. You can either set
47a base type for your complex type, or you add a content model to it, but you
48cannot do both.</choice>
49<choice>Your group is automatically created with a sequence content model
50child. Expand it in the Outline view to see it and select it. In the Properties
51view, you can select to change it to a <uicontrol>choice</uicontrol> or <uicontrol>all</uicontrol> content
kpricede20a692008-04-24 00:27:47 +000052model by selecting these options from the <uicontrol>Kind</uicontrol> drop-down.</choice>
kprice159fa582006-05-08 21:30:45 +000053</choices>
kpricede20a692008-04-24 00:27:47 +000055<step importance="optional"><cmd>Select the appropriate value in the <uicontrol>Minimum
56Occurr<?Pub Caret?>ence</uicontrol> field.</cmd><info>This is the minimum
57number of times the content model must appear. If you want the content model
58to be optional, select <uicontrol>0</uicontrol>. Otherwise, select <uicontrol>1</uicontrol>. </info>
60<step importance="optional"><cmd>Select the appropriate value in the <uicontrol>Maximum
61Occurrence</uicontrol> field.</cmd><info>This is the maximum number of times
62a content model can appear. You can select <uicontrol>unbounded</uicontrol> to
63indicate there is no maximum number of occurrences.</info></step>
kprice159fa582006-05-08 21:30:45 +000064<step><cmd>Click the <uicontrol>Documentation</uicontrol> tab if you want
65to provide any information about this content model.</cmd><info>The <uicontrol>Documentation</uicontrol> page
kpricede20a692008-04-24 00:27:47 +000066is used for human readable material, such as a description.</info></step>
kprice647b7352006-05-17 21:27:16 +000067<step><cmd>Click the <uicontrol>Extensions</uicontrol> tab if you want to
68add application information elements to your annotations of schema components.</cmd>
69<info>The <uicontrol>Extensions</uicontrol> page allows you to specify the
70schema and add XML content to your annotations.</info></step>
kprice159fa582006-05-08 21:30:45 +000071</steps>
kpricede20a692008-04-24 00:27:47 +000072<postreq><p>You can add the following items to a content object model: </p><ul>
kprice159fa582006-05-08 21:30:45 +000073<li>Another content model.</li>
74<li>A group reference which enables the referenced group to appear in the
75instance document in the context of the referencing declaration. This menu
76option only appears if there are global groups defined elsewhere in the document
77or if groups are defined in included schemas.</li>
78<li>An element, fundamental building blocks in XML.</li>
79<li>An element reference, which provides a reference to a global element.
80This menu option only appears if there are global elements defined elsewhere
81in the document.</li>
82<li>An <codeph>any</codeph> element. You can use an <codeph>any</codeph> element
83to extend your content model by any elements belonging to a specified namespace.</li>
kpricede20a692008-04-24 00:27:47 +000087<?Pub *0000005101?>