Create XML question

Hi Everyone,

I’m having difficulty in creating XML. It would be great if someone could shed light here.

I would like to create XML files in the format below:

image

I defined a data structure for this XML and I think it went fine.

The problem is that there is always only one segment.

When I tried the following input:

image

I got the first entry only out of the 8 entries in the array as shown below:

In this case, the Create XML settings are:

When I tried the following input:

image

I had 8 XML files as shown below:

In this case, the Create XML settings are:

I would like to see all 8 entries in one XML file.

How can I make it happen? I appreciate your advice here.

Thank you,

Kaz

Welcome to the Make community!

Please do not just provide screenshots, providing the output bundle as text will help others build a scenario for you.

1. Screenshots of module fields and filters

Please share screenshots of relevant module fields and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:
Screenshot_2023-10-07_111039

2. Scenario blueprint

Please export the scenario blueprint file to allow others to view the mappings and settings. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

Screenshot_2023-08-24_230826
(Note: Exporting your scenario will not include private information or keys to your connections)

Uploading it here will look like this:

blueprint.json (12.3 KB)

3. And most importantly, Output bundles

Please provide the output bundles of the modules by running the scenario, then click the white speech bubble on the top-right of each module and select “Download output bundles”.
Screenshot_2023-10-06_141025

A.

Save the bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

Uploading it here will look like this:

bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted output bundle in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

samliewrequest private consultation

Join the unofficial Make Discord server to chat with us!

1 Like

Oh, I’m sorry, and thank you for the recommendations.

Here is the output bundles for the 1st scenario (array includes 8 items):

Bundle_Array.txt (1.0 KB)
Bundle_XML_Array.txt (336 Bytes)

Here is the output bundles for the 2nd scenario (8 bundles):

Bundle_8-bundles.txt (935 Bytes)
Operation 1:
Bundle_XML_Array.txt (336 Bytes)
Operation 8:
Bundle_XML_8-bundles_8.txt (328 Bytes)

In summary, there are 8 strings that I would like to include to one XML file. But, for the time moment, Scenario 1 outputs one XML with only the first string, and Scenario 2 outputs 8 XML files and each XML file includes a single string.

I also tried to feed the following bundle by using the Text Aggregator module:

Bundle.txt (240 Bytes)

But, in this case, I don’t know how I can specify the id attribute of each trans-unit item.

Here is what I would like to obtain:

<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2">
    <file source-language="en" datatype="plaintext" original="file.txt">
        <body>
            <trans-unit id="1">
                <source>Agile Organization Characteristics</source>
            </trans-unit>
            <trans-unit id="2">
                <source>Progressive steps</source>
            </trans-unit>
            <trans-unit id="3">
                <source>Proactive effort</source>
            </trans-unit>
            <trans-unit id="4">
                <source>Organizational Unity</source>
            </trans-unit>
            <trans-unit id="5">
                <source>Aligned vision, goals, and values</source>
            </trans-unit>
            <trans-unit id="6">
                <source>Flexibility</source>
            </trans-unit>
            <trans-unit id="7">
                <source>Take advantage of opportunities</source>
            </trans-unit>
            <trans-unit id="8">
                <source>Aligned leadership support</source>
            </trans-unit>
        </body>
    </file>
</xliff>

Module [55] seems to be an Iterator. You need an Array Aggregator to compile the array of items down into a mappable “array” variable for the “trans-unit” field.

Every result (item/record) from a iterator module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and has applies to many use-cases.

There are other types of aggregator modules, click the below links to find out more:

Read This

The Array Aggregator module allows you to build a complex array of collections for a later module’s field to map multiple items (collections) to it.

Here is an example of using the “Target structure type” of an Array Aggregator module:

As you can see, the “Map” toggle on fields are used when you have an array. You can easily build an array variable to map to a field, by using an Array Aggregator module and select the “Target Structure Type” as the future field you want to map the array into.

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

3 Likes

Thank you very much for the reply. I was able to solve the problem by changing the Target structure type of the Array aggregator module and make necessary adjustments in the Settings of the CreateXML module.

A few screenshots for those who might have similar issues:

2 Likes