Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Web Tools Guide
Previous Page Home Next Page

Adding simple types

Simple types are used to create derived data types. They provide a set of constraints on the value space (a set of values) and the lexical space (a set of valid literals) of a datatype.

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 have a simple type.

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

To add a simple type, complete the following steps:

  1. Open your XML schema in the XML schema editor.
  2. In the Outline view, right-click Types, and click Add Simple Type.
  3. In the Outline view, select the new simple type.
  4. In the Properties view, click the General tab.
  5. Type a new name for the simple type in the Name field.
  6. You can select the following options from the Variety 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: union types enable an element or attribute value to be one or more instances of one type drawn from the union of multiple atomic and list types.
  7. If you selected atomic or list from the Variety list, click Browse This graphic is the Browse button next to the Base type or Item type field to specify a base type for the simple type. The Set Type dialog box 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: lists all of the types available in your current file.
    • Working Sets: lists all the types available within the selected working set.
  8. If you selected union from the Variety list, click Browse This graphic is the Browse button next to the Member types field to specify the member types for the simple type. You can select to add both Built-in simple types and User-defined simple types to the member types value list.
  9. To set specific constraint values on your simple type, such as length constraints, enumerations, and patterns, click the Constraints tab.
    1. You can use enumerations to define a set of valid values for simple types. They are the actual values the simple type can take as valid values in the instance document. You can add one enumeration or several enumerations at a time:
      • To add one enumeration at a time, under Specific constraint values, select Enumerations and click Add and specify a value for the enumeration.
      • To add several enumerations at one time:
        1. Select Enumerations and click Add.
        2. 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".
        3. Select the Preserve leading and trailing whitespace check box if you want any white space around your enumeration values to be preserved. If 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 entering the value.
        4. Click OK. Your enumerations will be created and appear in the Properties view.
    2. You can use patterns to place certain constraints regarding allowable values. For example, you could restrict the field to only accept input which follows the pattern "five digits followed by two upper-case ASCII letters". To set a pattern constraint:
      1. Select Patterns and click Add.
      2. Create the regular expression pattern you wish to use as your constraint using the Regular Expression wizard.
      3. Click Finish.
  10. 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.
  11. 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.
  12. If you do not want the simple type to be used to derive other types, click the Advanced tab and, in the Final list, select if derivations should be prevented by list, restriction, union or #all.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire