Defining user-defined elements
You can add, reuse, rename, transform, and delete a user-defined element directly into your message map during the development phase.
About this task
A user-defined element is an element that you can add directly into a message map to define the data of an extension point, which is shown as any or anyAttribute in the map.
- The local environment tree variables folder
- The message body
- xsd:any elements in your message body
- The Environment tree
- The transport headers that include extension points such as MQRFH2
You can also use user-defined elements to define a JSON message, and a SOAP or XML message that has an xsd:any.
- Simple type user-defined elements
- Complex type elements
- Repeatable user-defined elements
- You can define a simple type user-defined element or 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 define user-defined attributes within a complex user-defined element.
- You can set the type of a user-defined element or attribute from an existing global type definition. You can use any available message models, XML schemas, or DFDL schemas. For more information, see Choosing the project structure when you create a message map.
JSON elements are defined as nillable by default to allow the JSON null value. The Graphical Data Mapping editor creates all JSON user-defined elements as nillable.
- The Graphical Data Mapping editor does not create any other type of user-defined element as nillable. For this reason, if you use the Add User-Defined function to add XML elements, they cannot be defined as nillable. If you need nillable XML elements, you must define a schema model for them.
- You cannot use user-defined elements as the input or output of a submap.
When you use the Graphical Data Mapping editor to transform a JSON message, ensure that the JSON element names that you define by using the Add User-Defined function are valid according to the XML rules for naming elements. JSON allows a wider range of characters than XML, for example a JSON object might include the @ character. However, the Graphical Data Mapping editor allows element names that are valid in XML or XPath.
You can do any of the following actions with user-defined elements:
Create a user-defined element by using the Add User-Defined function. For more information, see
Adding and renaming a user-defined element.
- You can create a simple or a complex user-defined type. For more information, see Defining the structure of a complex user-defined element.
- You can rename a user-defined element.
- You can set the cardinality. For more information, see Configuring the cardinality of a user-defined element.
- Reuse multiple times a user-defined element. For more information, see Reusing a user-defined element in a message map.
- Specify transforms where a user-defined element can be an input element to the transform, or an output element. For more information, see Specifying a transform (mapping operation).
- Delete a user-defined element. For more information, see Deleting a user-defined element.
What to do next
After you add your input and output objects, create the connections between them, and specify your transforms, you can test your message map. For more information, see Troubleshooting a message map.