Users Online

· Guests Online: 141

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

Informatica Tutorial on Transformations

XML Parser Transformation in Informatica

The XML Parser Transformation in Informatica is an Active and Connected transformation. This transformation is useful to extract XML data from files inside a pipeline.

In this article, we will show you how to use XML Parser Transformation in Informatica to extract data from an XML file and load it into the Database table with an example. 

For this Informatica XML Parser Transformation example, we are going to use the below show XML file

XML Source file 1

XSD that we are going to use is:

XSD File 2

And the Destination table is Customer Record. As you can see, it is an Empty table  

 

XML Destination table 3

XML Parser Transformation in Informatica Example

In this article, we will show you how to use this XML Parser Transformation in Informatica to read XML data from the CSV file to the SQL Database table.

Before we start configuring, First, let me connect with the Informatica 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 Admin Username and password that you specified while installing the Server. 

 

Step 1: Source Definition for XML Parser Transformation in Informatica

Once you connected successfully, Please navigate to Source Analyzer to define your Sources. As we said before, we are using the XML file present in the local File System as our source definitions. So, Please navigate to Source menu, and select the Import from File.. option

Import XML file to Sources 4

Once you choose the Import from File.. option, a new window called Open Flat File will open. Please select the XMLCustomers.csv file from your local file system and click the Open button. I suggest you refer Flat File Source article to under the following steps.

   Select XML File as Source Definition 5

Once you click the Open button, a new pop up window called Flat File Import Wizard will open.

XML File Import Wizard 6

Within Step 2: Under Delimiter section, please select the delimiter

 XML delimiter 7

Here, we can edit the Column Name, Data type, Length or Precision, Scale, and Width. In general, we don’t do that, but if you want, you can do it.

XML File datatype as text 8

From the below screenshot you can observe that we can see our newly created Flat File source. 

XML Parser Transformation in Informatica 9

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

Please navigate to Target Designer to define the Target for Informatica XML Parser Transformation. In this example, we are using the existing SQL table (Customer Record) as our target definition. You can refer to Create Target table using Source Definition to understand the process of creating a target definition

 XML Parser Transformation in Informatica 10

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

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

XML Parser Transformation in Informatica 11

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

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

XML Parser Transformation in Informatica 12

Drag and drop the XML Customers flat file 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 Parser Transformation in Informatica

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

XML Parser Transformation in Informatica 13

Once you click on the Create.. option, Create Transformation window will open. Please select the XML Parser Transformation from the drop-down list and specify the unique name (XML_ParseCustomer) and click on Create button

XML Parser Transformation in Informatica 14

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 file is a local file system, then select this option.
  • URL: Select the file at particular URL
  • Non-XML Sources: If the source is a Non-XML file (SQL table) and if it is present in the Informatica Source definition.
  • Non-XML Targets: If the source is a Non-XML file, and if it is present in the Informatica Target definition

Please select the CustomerXSD.xml file from your local file system and click the Open button.  

 

XML Parser Transformation in Informatica 15

Click Yes or No as per your requirement

XML Parser Transformation in Informatica 16

If you select Yes from the above screenshot then the following window opens. Change XML Views Creation and naming Option will be displayed. Please change the options as per your requirements.

XML Parser Transformation in Informatica 17

It will open an XML wizard. Click Next button 

XML Parser 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 are using the Entity relation XSD. So, we are selecting the first option.

XML Parser Transformation in Informatica 19

Once you click on the Finish button, XML Parser Transformation in Informatica workspace added to the mapping designer.  

 

XML Parser Transformation in Informatica 20

First, let me add the XML field from Source Qualifier to XML Parser Transformation. Next, Drag and drop the target definition from the Targets folder to the mapping designer.

XML Parser Transformation in Informatica 21

Next, connect the XML Parser Transformation fields to the Customer record Target table.

XML Parser Transformation in Informatica 22

Step 4: Create a Workflow for XML Parser 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 Parser Transformation example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.

XML Parser Transformation in Informatica 23

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

XML Parser 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 Parser Transformation in Informatica

There are two types of sessions:

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

XML Parser Transformation in Informatica 25

Please provide a unique name for this session. Here, we are naming it as s_XMLParseCustomer. 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_XMLParser.

XML Parser 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 set the Source connection by clicking on the SQ_XMLCustomers present in the Sources folder.

  • Source File directory: It will use the default directory, but you can change the directory by giving the full path. For example, D:\File Examples\
  • Source filename: It will automatically detect. If not, please specify the file name along with the extension.
XML Parser Transformation in Informatica 27

Next, we have to configure the target connection. So, select the CustomerRecord under the targets folder.

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

Target Database for XML 28

Change the Target Load type based on your requirement

XML Parser Transformation in Informatica 29

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

XML Parser Transformation in Informatica 30

Now, Let me start the Informatica XML Parser Transformation Workflow. To do so, navigate to the Workflows menu and select the Start Workflow option.

XML Parser Transformation in Informatica 31

Let’s open the SQL Server Management Studio and write following SQL Query to check whether we successfully transfered XML data into the table or not.

XML Parser Transformation in Informatica 32

 

 

 

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 1.87 seconds
10,814,452 unique visits