# Adding elements

Elements are fundamental building blocks in XML. Element declarations provide value constraints, provide a description that can be used for validation, establish constraining relationships between related elements and attributes, and control the substitution of elements.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

To add an element, complete the following steps:

1. To add an element, in the Design view, right-click the content model (sequence, choice, or all element) you want to work with and click Add Element. The element appears attached to the content model in the Design view.
   1. In the Design view, select the element, and click the current (default) name of the element, which puts you in direct editing mode, then type the new Name and press enter.
   2. In the Design view, click the current (default) element type and select a type from the menu. Alternately, you can select browse to invoke the Set Type dialog for more options. The Set Type dialog lists all built-in and user-defined types currently available. You can change the Scope of the list by selecting one of the following options:
      - Workspace: lists all of the types available in your workspace.
      - Enclosing Project: lists all of the types available in the project that contains your file.
      - (Default) Current Resource: list all of the types available in your current file.
      - Working Sets: list all the types available within the selected working set.
2. (Optional) In the Properties view, select the appropriate value in the Minimum Occurrence field. This is the number of times the element can appear in an instance document. If you want the element to be optional, select 0. Otherwise, select 1.
3. (Optional) Select the appropriate value in the Maximum Occurrence field. This is the maximum number of times the element can appear in an instance document. 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 element. The Documentation page is used for human readable material, such as a description.
5. 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 a content model to an element, which is the representation of any data that can be contained inside the element. For more information about working with content models, refer to the related tasks.
Related tasks
Adding content models
Adding element references
Adding an any element
Adding global attributes