Adding a simple type
In the XML schema editor, you can add a simple type to an XML schema. A simple type cannot have element content and cannot carry attributes. Elements that contain numbers (and strings, and dates, and so on) but do not contain any sub-elements are said to have simple types.
The following instructions were written for the Resource perspective, but they will also work in many other perspectives.
To add a simple type,...
- Open your XML schema in the XML schema editor.
- In the Outline view, select your schema. The entire schema and its contents should be displayed in the Graph view.
- In the Graph view, right click in the Types section and click Add Simple Type.
- In the Properties view, click the General tab, and type a new name for the simple type in the Name field.
- You can select the following options from the Variety drop down list:
- atomic - atomic types are all the simple types built into the XML schema language
- list - list types are comprised of sequences of atomic types. They have values that are comprised of finite-length sequences of atomic values.
- union - a union type enables an element or attribute value to be one or more instances of one type drawn from the union of multiple atomic and list types
- If you selected atomic from the Variety drop down list, click the More button next to the Base type field to specify a base type for the simple type. You can select either a Built-in simple type, or User-defined simple type to be the base type.
- If you selected list from the Variety drop down list, click the More button next to the Item type field to specify a item type for the simple type. You can select either a Built-in simple type, or User-defined simple type to be the item type.
- If you selected union from the Variety drop down list, click the More button next to the Member types field to specify the member types for the simple type. You can select both Built-in simple type, or User-defined simple type to add to the member types list.
- Click the Enumerations tab. Enumerations help you to define a set of valid values for simple types. Enumerations are the actual values the simple type can take as valid values in the instance document. You can either add one enumeration or several enumerations at a time:
- To add one enumeration at a time, click the Add button and specify a value for the enumeration.
- To add several enumerations at one time,...
- Click the Add... button.
- Enter the value of each enumeration. Each value must be separated by the Delimiter character. For example: First, Second will create two enumerations, one with the value "First" and one with the value "Second".
- Select the Preserve leading and trailing whitespace check box if you want any white space around your enumeration values to be preserved. If, for example, you select this check box, the values of First, Second will show up as "First" and " Second" (there is a space before Second) because you put a space before "Second" when entered the value.
- Click OK. Your enumerations will be created and appear in the Properties view.
- Click the Documentation tab if you want to provide any information about this simple type. 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.
- Click the Advanced tab. The options available from this page will vary depending on what option you selected in the Variety field, and the Base type, Item type, or Member types field on the General page.
- If applicable to the type, the Facets table will be populated with constraining facets. A constraining facet is an optional property that can be applied to a datatype to constrain its value.
- To change a facet's value, click its name in the Name column, then click its value (or the empty cell that will contain its value) in the Value column and type or select a new value
- To change whether a facet's value is fixed or not, click its name in the Name column, then click the appropriate cell in the Fixed column, and change the value to true or false.
- If applicable to the type, a Pattern page will be available. Click the Pattern tab to switch to it. A pattern can be used to constrain the value of a type's lexical space (the set of string literals that represent the values of a type), which indirectly constrains the value space. For more information on adding a pattern to a simple type, refer to the related tasks.