Adding and renaming a user-defined element

You can add a user-defined element by using the Add User-Defined function. You can add simple type or complex type user-defined elements.

Procedure

To create a user-defined element, complete the following steps:

  1. Select the extension point any under which you want to add a user-defined element.
  2. Select Add User-Defined. You can choose any of the following methods:
    • Right-click the element any. A menu appears. Select the Add User-Defined function.

      Displays the menu that appears when you right-click the element any.

    • Select the Add User-Defined function by selecting the Add User-Defined icon Add user-defined icon that is available on top of the field.

      This figure shows the icons that are available to cast the any field or to add a user-defined element.

    An element is added under the any field.

    The default type of a new created user-defined element is string.

  3. Click the user-defined element, and then enter the name of the element. If the name uses a dash '-' character, you must enter it by typing in the "Name" field of the Properties view, you cannot type '-' in the in-field name widget.

    If the user-defined element name exists in multiple places, you are prompted to select an action that determines whether to reuse or rename an existing user-defined element in multiple places in the map.

  4. Specify the user-defined element type. Complete the following steps:
    1. Click the type of the user-defined element.
    2. Select the type of the user-defined element.
      Note: The default type is string.
      • To configure a simple type, choose from any of the following values:
        • Boolean
        • date
        • dateTime
        • decimal
        • double
        • duration
        • float
        • hexBinary
        • int
        • long
        • string
        • time
      • To configure a complex type, choose <Anonymous>.
      • To configure a JSON array, choose JSONArray_Default.
      • To set the type by using a global XML schema, choose Browse, and select the type. You can set the type to an XML schema or to a DFDL schema.
        When you define the user-defined element type by using a global XML schema, the following rules apply:
        • You can have the map and any schema definitions that are used in the map in the same project. The project can be a static library project, a shared library project, or an application project.
        • You can have any schema definition that is used in the map in a static library project and the map in an application project.
        • You can have any schema definition that is used in the map in a shared library project and the map in a different shared library project.
        • You cannot have the schema definitions that are used in the map in a shared library and the map in an application project. The Graphical Data Mapping editor reports error CWMSL209E if you break this rule.
        Note: You can get error CWMSL209E when the type of the user-defined element references an unresolved schema. To resolve this problem, add the schema in the Scope tab of the map Properties view, or add the dependency to the map container project. Then, reselect the type.
  5. When you add elements to a complex user-defined element, you define the cardinality for each child element that you add. The cardinality defaults to Minimum occurrence and Maximum occurrence of 1. For more information, see Configuring the cardinality of a user-defined element.
    Note: You cannot change the cardinality for user-defined elements that are within the choice group that is created for you when you define elements at the level of the xsd:any wildcard. The cardinality is determined by the cardinality set on the xsd:any.

What to do next