XML Generator Transformation in Informatica

The XML Generator Transformation in Informatica is an Active and Connected transformation. This transformation is useful in generating XML files inside a pipeline.

In this article, we will show you how to use XML Generator Transformation in Informatica to generate an XML file from the Database table with an example.

For this Informatica XML Generator Transformation example, we are going to use the below show data (Customer record table)

XML Generator Transformation in Informatica 1

XML Generator Transformation in Informatica Example

Let’s see how to use this XML Generator Transformation in Informatica to generate an XML file using the SQL Database table. Before we start configuring, First, let me connect with the repository service.

To do so, we have to provide the Admin Console credentials. So, Please provide the appropriate Username and Password, and click the Connect button.

TIP: Here, you have to provide the Informatica Admin Username and password that you specified while installing the Server.

Step 1: Source Definition for XML Generator Transformation in Informatica

Once you connected successfully, please navigate to Source Analyzer and define your Sources. In this example, we are using the Customer table from the SQL Server database as our source definitions. Please refer Database Source to understand the steps involved in creating source definition

XML Generator Transformation in Informatica 2

Step 2: Create Target Definition for XML Generator Transformation in Informatica

First Approach – Please navigate to Target Designer to define the Informatica XML Generator Transformation Target. In this example, our task is to create an XML File. So, go to the Targets menu and select the Import XML Definition option. By this, you can define the XML Definition inside a Target definition.

XML Generator Transformation in Informatica 3

Ideal Approach – Go to Targets menu and select the Create option.

XML Generator Transformation in Informatica 4

Once you select the Create option, a new window called Create Target table will be displayed as shown below. Please provide a unique name for the target, and select the database type as Flat File. 

Once you complete, Please click on the Create button to create a new empty table in our PowerCenter Target Designer.

XML Generator Transformation in Informatica 5

Double-click on the newly created target table. Next, go to the Columns Tab to add a new column. Please select the first button (before the scissors symbol). It opens the empty row to add Column Name, Data Type

From the below screenshot, you can observe that we added one XML_Output column of a string data type.

XML Generator Transformation in Informatica 6

Now you can see the target table with one column name. It is the column that handles the XML file.

XML Generator Transformation in Informatica 7

Step 3: Create a Mapping for XML Generator Transformation in Informatica

To create a new mapping for Informatica XML Generator Transformation, Please navigate to Mappings menu in Menu Bar, and select the Create.. option.

XML Generator Transformation in Informatica 8

It will open the Mapping Name window to write a unique name for this Mapping. Let me write m_xml_generator and click OK button.

TIP: Please refer Mapping article to understand the procedure to create Mapping

XML Generator Transformation in Informatica 9

Drag and drop the Customer record source definitions from Sources folder to the mapping designer. Once you drag the Source, the Power Center designer will automatically create the source qualifier for you. I suggest you refer to the Source Qualifier Transformation article.

Step 3(a): Create a XML Generator Transformation in Informatica

To create an XML generator Transformation, Please navigate to the Transformation menu in Menu Bar and select the Create.. option.

XML Generator Transformation in Informatica 10

Once you click on the Create.. option, Create transformation window opened. Please select the XML Generator Transformation from the drop-down list and specify the unique name (XML_GenCustomer) and click on Create button

XML Generator Transformation in Informatica 11

Once you click on the Create.. button, a new window called Import XML Definition will be opened as shown below. Here, you have to specify the XSD or XML definition for this XML file.

Local File: If the XSD file is in the local file system, then select this option.

XML Generator Transformation in Informatica 12

URL: Select the XML definition file at particular URL

XML Generator Transformation in Informatica 13

Non-XML Targets: If the source is a Non-XML file, and if it is present in the Target definition

XML Generator Transformation in Informatica 14

Non-XML Sources: If you don’t have an XSD file and want to use the SQL table in the Source definition, then select this option. For this example, we are going to use the Customerrecord table present in the Source definition.

XML Generator Transformation in Informatica 15

Click Open

XML Generator Transformation in Informatica 16

Click No

XML Generator Transformation in Informatica 17

It will open an XML wizard. Click Next button

XML Generator Transformation in Informatica 18

Every XML file has to be processed using a Valid XML Definition (or XSD). Please define the XML definition in the second page. In this example, we want to save our XML file using Entity relation. So, we are selecting the first option.

XML Generator Transformation in Informatica 19

Once you click on the Finish button, XML Generator Transformation added to the mapping designer.

XML Generator Transformation in Informatica 20

Now let me add all the fields from Source Qualifier to XML Generator Transformation

XML Generator Transformation in Informatica 21

Next, Drag and drop the target definition from the Targets folder to the mapping designer. Next, connect the XML Generator Transformation data output to the XML_Output field in the Target table.

XML Generator Transformation in Informatica 22

Before we close the Mapping, Let us Save, and Validate the mapping by going to Mapping Menu bar, and select the Validate option.

Step 4: Create a Workflow for XML Generator Transformation in Informatica

After we finish creating the Mapping, we have to create the workflow for it. Power Center Workflow manager provides two approaches to create a workflow.

In this Informatica XML Generator Transformation example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.

XML Generator Transformation in Informatica 23

It will open the Create Workflow window. Please provide the unique name (wf_XMLGenerator) and leave the default

XML Generator Transformation in Informatica 24

Once we created the workflow, our next step is to create a session task for our mapping.

Step 4(a): Create Session for XML Generator Transformation in Informatica

There are two types of sessions:

For this Informatica XML Generator Transformation example, we created a Non-reusable Session. To create Non-reusable Session, Please navigate to Tasks Menu and select the Create option.

XML Generator Transformation in Informatica 25

Please provide a unique name for this session. Here, we are naming it as s_XMLGenerator. Once you click on the Create button, a new window called Mappings opened.

Here you have to select the mapping that you want to associate with this session i.e., m_xml_generator.

XML Generator Transformation in Informatica 26

Double click on the Session task will open the Edit Tasks window. Within the Mappings tab, we have to configure the Source, and Target Connections. First, let us configure the source connections by clicking on the SQ_CustomerRecord source present in the Sources folder.

Within the Connections, click on the Arrow button beside the Relational type, and select the source table database (Source)

XML Generator Transformation in Informatica 27

Now you can see the Source as the relational connection

XML Generator Transformation in Informatica 28

Now, we have to configure the Target Connection. So, let us configure the target connection by clicking on the XMLCustomer_Records in the Targets folder.

  • Output File Directly: It will use the default directory, but you can change the directory by giving the full path.
  • Output filename: Please change the extension to XML
XML Generator Transformation in Informatica 29

You can use the Transformation properties to Validate or Format the Output (generated XML) file

XML Generator Transformation in Informatica 30

Next, navigate to Workflows Menu and select the Validate option to validate the Workflow.

XML Generator Transformation in Informatica 31

Now, Let me start the Informatica XML Generator Transformation Workflow by selecting the Start Workflow option in Workflows Menu.

XML Generator Transformation in Informatica 32

Let us open the default target location of the Informatica to check whether we successfully created an XML file from the source table or not.

XML Generator Transformation in Informatica 33

You can see the data inside the xmlcustomer_records xml file.

XML Generator Transformation in Informatica 34