Show TOC

Managing Data TypesLocate this document in the navigation structure

Use

In the Data Types Editor (DTE), you can open any XSD file from your workspace and manage its content. You can edit the data types in one namespace at a time, define the relationship between them and reuse them in the XSD schema that you open for editing. You can later reuse the XSD schema or specific data types defined in it. Those types can later be imported by other XML schema documents or WSDL documents.

Optionally, you can directly edit the XML schema in the dedicated Source section of the editor. If you create an XSD file form scratch, you need to define its namespace and add data objects and other elements.

You can use the context menu of the attributes to add new ones, delete an attribute, or copy and paste data types within a namespace.

Using the DTE, you can:

  • Create new data types of simple and structure type.

  • Add global elements.

  • Add elements and attributes.

  • Edit the details of each data type, change the base type and define constraints for simple types.

  • Add and delete elements.

  • Edit the source code.

Prerequisites

You need to either:

  • Create a new XSD file.

    or

  • Open an existing XSD file stored in your workspace.

Procedure

Creating an XSD File

  1. From the menu path, choose Start of the navigation path File Next navigation step New Next navigation step Other Next navigation step XML End of the navigation path. Expand the node and choose XML Schema .

  2. In the dialog that appears specify the details for the file that you want to create.

    Select the development component and the exact folder in which you want to store the new service interface. Optionally, you can change the XSDfile default name. Choose the Next pushbutton.

  3. Optionally, you can choose the Advanced pushbutton and link your XML file to another file in the file system.

  4. Choose the Finish pushbutton.

Adding Simple and Structure Types

You can create simple types of primitive type or simple types derived from any other simple type that you may later use to define elements or attributes. You can also create structure types with one or more element and attributes.

  1. Open the XSD file where you want to add a new simple type by opening the context menu and navigating to Start of the navigation path Open with Next navigation step  Other Next navigation step Data Types Editor End of the navigation path. Choose the Add Simple Type pushbutton or select it from the context menu..

    You can do the following:

    • Specify an appropriate name for the simple type you added.

      Note

      The DTE defines a default name for your new simple type. In case you define an invalid name, i.e. it is duplicated, an error marker is displayed. You can see a description of the error in the Problems view of the Developer Studio.

    • Change the base type by choosing from the list of primitive types in the dropdown menu.

    • Change the base type by choosing the Browse pushbutton. You can

      • Choose from the list of the types contained in the current XSD schema

      • Filter your search scope by choosing whether you want to search for types in your opened file ( Current Resource ), all XSD schemas and WSDL files in the current project ( Enclosed Project ) or in the whole workspace ( Workspace ). You can also search in workspaces you previously created.

    • Create a new type by choosing the New pushbutton. Enter a valid and unique name for the data type or element.

    • In the Documentation field, add any information about the data type that you want the user to see.

    • Optionally, you can define constraints for the new simple type. Possible constraints vary, depending on the base type.

  2. To add a new structure type, choose the Add Structure Type pushbutton and define a valid name for the type.

    You can now add attributes and elements to your structure type.

Adding Elements and Attributes

You can create new elements and attributes of simple or structure type and then add them to another structure type.

  1. To add a new attribute, choose the Add Attribute pushbutton (or select this action from the context menu) and define a valid name.

  2. To add a new element, choose the Add Element pushbutton (or select this action from the context menu) and define a valid name.

  3. You can do the following:

    • Change the type by choosing from the list in the dropdown menu.

    • Change the type by choosing the Browse pushbutton. You can:

      • Choose from the list of the types contained in the current XSD schema.

      • Filter your search scope by choosing whether you want to search for types in your opened file ( Current Resource ), all XSD schemas and WSDL files in the current project ( Enclosed Project ) or in the whole workspace ( Workspace ). You can also search in workspaces you previously created.

    • Create a new type by choosing the New pushbutton. Enter a valid and unique name for the data type or element.

      Depending on the type of the element, you can edit its cardinality or nillability.

    • In the Documentation field, add any information about the data type that you want the user to see.

  4. Optionally, you can define constraints for the elements or attributes of simple type. Possible constraints vary, depending on the type.

    Note

    When you put constraints on elements or attributes of simple type, they automatically become anonymous.

Adding Global Elements

You can create new global element and later reuse it in other structures, schemas or elements that refer to it. When you create a new global element, its type it is anonymous by default. When another structure or element refers to this global element, structure of the global element is displayed in the tree as read-only.

  1. To add a new element, choose the Add Global Element pushbutton. The element is anonymous by default.

  2. 2. To change the type of the global element, choose the Browse pushbutton. You can:

    • Choose from the list of the global types contained in the current XSD schema.

    • Filter your search scope by choosing whether you want to search for types in your opened file ( Current Resource ), all XSD schemas and WSDL files in the current project ( Enclosed Project ) or in the whole workspace ( Workspace ). You can also search in workspaces you previously created.

Creating New Data Types

You can easily create new data types by choosing the New pushbutton (or select this action from the context menu) and editing its details.

Removing Elements and Data Types

You can easily delete any data type or element by selecting it and choosing the Remove pushbutton or from the context menu..

Note

In case you delete an element, referenced by another element or structure, the second element becomes invalid and an error marker is displayed. To see a description of the error, open the Problems view of the Developer Studio.

Copying Elements and Data Types

Using the SIE, you can easily copy data types and elements to other namespaces. For more information, see Managing Service Interfaces .

Managing Imported Types

When you model a type by using a type, defined in another XSD schema, the schema is automatically imported and displayed in the Imported node at the end of the tree. The data types in the imported schema are read-only. To edit an imported data type according to your needs, copy it in one of the elements or structures in your XSD file.