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.
There are three different kinds of content models:
- Sequence, 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.
- Choice, which means that only one of the content model's children
can appear in an instance of the XML schema.
- All, 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.
The following instructions were written for the Resource perspective,
but they will also work in many other perspectives.
To add a content
model to an element, global element, complex type, or group, complete the
following steps:
- In the Design view, select your complex type, or group:
- If you selected a complex type, you can right-click it and click Add
Sequence, or Add Choice to add the type
of content model you want to your complex type. If you wish to use the all content
model, you can change the model by clicking the model in the Design view,
and in properties, select all as the Kind.
Your content model is automatically added as a child of your complex type
- expand in the Outline view to see it. Note: 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.
- 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 choice or all content
model by selecting these options from the Kind drop-down.
- Optional: Select the appropriate value in the Minimum
Occurrence field. This is the minimum
number of times the content model must appear. If you want the content model
to be optional, select 0. Otherwise, select 1.
- Optional: Select the appropriate value in the Maximum
Occurrence field. This is the maximum number of times
a content model can appear. You can select unbounded to
indicate there is no maximum number of occurrences.
- Click the Documentation tab if you want
to provide any information about this content model. The Documentation page
is used for human readable material, such as a description.
- Click the Extensions tab if you want to
add application information elements to your annotations of schema components.
The Extensions page allows you to specify the
schema and add XML content to your annotations.
You can add the following items to a content object model:
- Another content model.
- 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.
- An element, fundamental building blocks in XML.
- 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.
- An any element. You can use an any element
to extend your content model by any elements belonging to a specified namespace.