Adding content models

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 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

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, follow these steps:

  1. In the Outline view, select your element, global element, complex type, or group:
    • If you selected an element or global element, you can right-click it, and click Add Sequence, Add Choice, or Add All 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.
    • If you selected a complex type, you can right-click it and click Add Sequence, Add Choice, or Add All 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. 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 list.
  2. (Optional) Select the appropriate value in the MinOccurs field. This is the number of times the content model must appear. If you want the content model to be optional, select 0. Otherwise, select 1.
  3. (Optional) Select the appropriate value in the MaxOccurs field. This is the maximum number of times a content model may appear. You can select unbounded to indicate there is no maximum number of occurrences.
  4. 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, and the App Info page can be used to provide information for applications.

You can add the following to a content object model.

Related tasks
Adding an any element
Adding elements
Adding element references
Adding group references