July 30, 2023

tFileOutputMSXML – Docs for ESB 7.x

tFileOutputMSXML

Creates a complex multi-structured XML file, using data structures (schemas) coming
from several incoming Row flows.

tFileOutputMSXML Standard properties

These properties are used to configure tFileOutputMSXML running in the Standard Job framework.

The Standard
tFileOutputMSXML component belongs to the File family.

The component in this framework is available in all Talend
products
.

Basic settings

File Name

Name and path to the file to be created and or the variable to be
used.

For further information about how to define and use a variable in
a Job, see
Talend Studio

User Guide.

Warning: Use absolute path (instead of relative path) for
this field to avoid possible errors.

Configure XML tree

Opens the dedicated interface to help you set the XML mapping. For
details about the interface, see Defining the MultiSchema XML tree.

Advanced settings

Create directory only if not exists

This check box is selected by default. It creates the directory
that holds the output delimited file, if it does not already
exist.

Advanced separator (for numbers)

Select this check box to modify the separators used for
numbers:

Thousands separator: define
separators for thousands.

Decimal separator: define
separators for decimals.

Encoding

Select the encoding from the list or select Custom and define it manually. This field is
compulsory for DB data handling.

Don’t generate empty file

Select this check box if you do not want to generate empty files.

Trim the whitespace characters

Select this check box to remove leading and trailing whitespace
from the columns.

Escape text

Select this check box to escape special characters.

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at a
Job level as well as at each component level.

Global Variables

Global Variables

NB_LINE: the number of rows read by an input component or
transferred to an output component. This is an After variable and it returns an
integer.

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Defining the MultiSchema XML tree

Double-click on the tFileOutputMSXML component to
open the dedicated interface or click on the three-dot button on the Basic settings vertical tab of the Component tab.

tFileOutputMSXML_1.png

To the left of the mapping interface, under Linker
source
, the drop-down list includes all the input schemas that should
be added to the multi-schema output XML file (only if more than one
input flow is connected to the tFileOutputMSXML
component).

And under Schema List, are listed all columns
retrieved from the input data flow in selection.

To the right of the interface, are expected all XML structures you want to create
in the output XML file.

You can create manually or easily import the XML structures. Then map the input
schema columns onto each element of the XML tree, respectively for each of the input
schemas in selection under Linker source.

Importing the XML tree

The easiest and most common way to fill out the XML tree panel, is to import a well-formed XML file.
  1. Rename the root tag that displays by
    default on the XML tree panel, by
    clicking on it once.
  2. Right-click on the root tag to display the contextual menu.
  3. On the menu, select Import XML
    tree
    .
  4. Browse to the file to import and click OK.

    • You can import an XML tree from files in XML, XSD and
      DTD formats.

    • When importing an XML tree structure from an XSD
      file, you can choose an element as the root of your XML tree.

    The XML Tree column is hence automatically
    filled out with the correct elements.
  5. If you need to add or remove an element or sub-elements, right-click the relevant element of the tree to display the contextual menu.
  6. Select Delete to remove the
    selection from the tree or select the relevant option among: Add sub-element, Add
    attribute
    , Add namespace
    to enrich the tree.

Creating the XML tree manually

If you don’t have any XML structure defined as yet, you can create it
manually.
  1. Rename the root tag that displays by
    default on the XML tree panel, by
    clicking on it once.
  2. Right-click on the root tag to display the contextual menu.
  3. On the menu, select Add sub-element to create the first element of the
    structure.
  4. If you need to add an attribute or a child element to any element or
    remove any element, right-click the left of the corresponding element name to display the contextual
    menu.
  5. Right-click to the left of the element name to display the contextual
    menu.
  6. On the menu, select the relevant option among: Add sub-element, Add
    attribute
    , Add namespace
    or Delete.

Mapping XML data from multiple schema sources

Once your XML tree is ready, select the first input schema that you want to map.

You can map each input column with the relevant XML tree element or sub-element to
fill out the Related Column.

  1. Click on one of the Schema column
    name
    .
  2. Drag it onto the relevant sub-element to the right.
  3. Release the mouse button to implement the actual mapping.

    tFileOutputMSXML_2.png

    A light blue link displays that illustrates this mapping. If available,
    use the Auto-Map button, located to the
    bottom left of the interface, to carry out this operation automatically.

  4. If you need to disconnect any mapping on any element of the XML tree, select the element and right-click to the left of the element name to display the contextual menu
  5. Select Disconnect link.

    The light blue link disappears.

Defining the node status

Defining the XML tree and mapping the data is not sufficient. You also need to define the loop elements for each of the source in selection and if required the group element.

Define a loop element

The loop element allows you to define the iterating object. Generally the Loop element is also the row generator.
To define an element as loop element:
  1. Select the relevant element on the XML tree.
  2. Right-click to the left of the element name to display the contextual
    menu.
  3. Select Set as Loop Element.

The Node Status column shows
the newly added status.

There can only be one loop element at a
time.

Define a group element

The group element is optional, it represents a constant element where the groupby operation can be performed. A group element can be defined only if a loop element was defined before.

When using a group element, the rows should sorted, in order to be able to
group by the selected node.

To define an element as group element:

  1. Select the relevant element on the XML tree.
  2. Right-click to the left of the element name to display the contextual
    menu.
  3. Select Set as Group Element.

The Node Status column shows the newly added
status and any group status required are automatically defined, if
needed.

Click OK once the mapping is complete to
validate the definition and continue the job configuration where needed.

Related scenarios

No scenario is available for the Standard version of this component yet.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x