merge xml attachments processor

Merge XML attachments processor

Version: 17.07

Supported Since: 17.07

What is a Merge XML Attachments processor?

A Merge XML attachments processor is a processing element which accepts a message with one or more XML attachments, merges them together under a provided root element and sets the resulting document as the current payload of the message.

It should be noted that the order in which the attachments will be merged, cannot be guaranteed.

In order to use this processing element, you must first select the Regular XML Processors dependency from the processor list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the Regular XML Processors dependency.

merge attachments outports

Out Ports

Next

The message will be sent to this outport if the attachment merging is executed successfully

On Exception

The message will be sent to this outport if the processing element failed to merge the attachments due to some reason

Parameters

Root element *

Basic

The qualified name of the root element under which the attachments should be merged. A custom prefix can be specified as myns:myqname.

Root element namespace

Basic

If it is required to add a custom namespace URI to the root element, it can be specified as the value of this parameter

Sample Use Case

In the following use case, an email will be received with multiple XML documents each containing contact information of person as attachments. The requirement is to merge these attachments into a single document under the root element <contacts> and save this final document into a file system location.

Prerequisites

In order to implement following use case following dependencies should be selected when an empty Ultra project is being created.

  • Mail Connector

  • Local File Connector

  • XML Processors

If the project is already created, above dependencies can be added via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list and Processors list, select above dependencies.

merge xml attachments flow

In this flow, a Mail Ingress Connector is used to retrieve the emails into the integration flow and its "Processor" outport is connected to the inport of the Merge XML attachments processor so that the email message received by the connector is handed over to the merger next.

The Root element property of the processor is configured as contacts and as a result, the processing element will merge the contents of the attachments under the tag <contacts>, set the merged content as the payload of the message and then handover it to the File Egress Connector. It will persist the message content as a file to a configured file system location.

Example

For example, assume that the message contains the following two XML documents as attachments.

<?xml version="1.0" encoding="UTF-8"?>
<person id="1">
    <name>Aladdin Strickland</name>
    <email>rhoncus@laciniaorciconsectetuer.ca</email>
    <company>At LLP</company>
    <country>Slovenia</country>
</person>
<?xml version="1.0" encoding="UTF-8"?>
<person id="2">
    <name>Chancellor Ayala</name>
    <email>luctus@ullamcorpernisl.com</email>
    <company>Nec Orci Inc.</company>
    <country>Lebanon</country>
</person>

Those will be merged under contacts root element as follows.

<?xml version="1.0" encoding="UTF-8"?>
<contacts>
    <person id="1">
        <name>Aladdin Strickland</name>
        <email>rhoncus@laciniaorciconsectetuer.ca</email>
        <company>At LLP</company>
        <country>Slovenia</country>
    </person>
    <person id="2">
        <name>Chancellor Ayala</name>
        <email>luctus@ullamcorpernisl.com</email>
        <company>Nec Orci Inc.</company>
        <country>Lebanon</country>
    </person>
</contacts>
Optionally a namespace URI can be added to the root element by configuring the Root element namespace property of the processing element.
In this topic
In this topic
Contact Us