Adding a content model
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.
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 a global element, complex type, or group,...
- In the Outline view, select your 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.
- (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.
- (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.
- 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.
- 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.