Defining the structure of a complex user-defined element

You can define the structure of a complex type by using the Add Element function. You can reorder the position of elements in your complex structure. You can also use global types such as XML schemas, DFDL schemas, JSON schemas, and Swagger documents to set the type of user-defined elements.

Before you begin

In a message map, add a user-defined element with <Anonymous> type to your input or output assembly. For more information, see Adding and renaming a user-defined element.

Figure that shows the initial structure that is created when you change the type of a user-defined element to an anonymous type.

About this task

You can define a complex user-defined element in the input message assembly or in the output message assembly.
  • You can include simple type attributes, simple type elements, complex type elements, and repeatable elements in a user-defined complex type element.
  • You can set the type of a user-defined element to a global complex type defined in an XML schema, DFDL schema, JSON schema, or Swagger document.
To set the cardinality of a complex user-defined type, you must differentiate whether the type is based on a global type or not.
  • When you set the type to a global type, you can configure the cardinality only through an XML schema or DFDL schema.
  • 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 in the Graphical Data Mapping editor 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.

Procedure

Complete the following steps to define the structure of a complex element:

  • Right-click the complex user-defined element, and select Add Child Element from the context menu.

    You can define simple type elements and complex type elements.

  • Specify the type of the element. Click the type of the element and choose one of the XML simple types, or select Browse to set the type from a global complex type from an XML schema, a DFDL schema, or a JSON schema or Swagger document that is in the same project container as the map. If you are casting to a type that is derived from a JSON schema or Swagger document, see JSON schema requirements for message maps for more information.
  • Modify the location of an element in your structure. Right-click the element that you want to move, and choose Move down to move down an element or Move up to move up an element.
  • Specify the cardinality of the element. Configure in the element Properties tab a value for the properties Minimum occurrences and Maximum occurrences. For more information, see Configuring the cardinality of a user-defined element.
  • Repeat the previous steps to define all the elements.

What to do next

Edit the message map, and define transformations between the input message assembly and the output message assembly. For more information, see Specifying a transform (mapping operation).