The XML Source Qualifier in Informatica is an Active and Connected transformation. While reading the XML Source definition, this is the default transformation generated by the Power Center Designer.
This Informatica XML Source Qualifier transformation determines how the Power Center reads the source data. Remember, XML Source Qualifier always has one input port or one output port.
In this article, we will show you how to use XML Source Qualifier Transformation in Informatica to Load Data From XML File to SQL Server with an example. For this example, we are going to use the below show XML file
XML Source Qualifier in Informatica Example
In this example, we will show you how to use XML Source Qualifier in Informatica. Before we start configuring, First, let me connect with the Informatica repository service.
To do so, we have to provide the Informatica Admin Console credentials. So, Please provide the appropriate Username and Password specified while installing the Informatica and click the Connect button.
Step 1: Create Source Definition for XML Source Qualifier 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 XML Definition.. option as shown below
Once you choose the Import XML Definition.. option, a new window called Import XML Definition opened.
- 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 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 xmlcustomer_records.xml file from your local file system and click the Open button.
It opens an XML wizard. Click Next button
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 XML file with Entity relation so, we are selecting the first option. If you are using an XML file Hierarchies, then select the second option, etc.
From the below screenshot you can observe that, you can see our newly created XML Source definition in Informatica
Step 2: Create Target Definition for XML Source Qualifier in Informatica
Please navigate to Target Designer to define the Target. In this example, we are using the existing SQL table (XMLCustomers) as our target definition. You can refer to Create a Target table using Source Definition to understand the process of creating a target definition
Step 3: Create Mapping for XML Source Qualifier in Informatica
To create a new mapping for XML source qualifier transformation in Informatica, Please navigate to the Mappings menu in Menu Bar and select the Create.. option.
Once you select the Create.. option, a new Mapping Name window will open. Let me provide m_XMLSource as the mapping name and click OK button.
TIP: Please refer Informatica Mapping article to understand the procedure to create Mapping
Step 3(a): Create XML Source Qualifier Transformation in Informatica
Drag and drop the XML source definition (xmlcustomer_records) from the Sources folder to the mapping designer. Once you drag the source, the Power Center designer automatically creates the XML source qualifier transformation for you.
Let me remove the XML Source Qualifier
Step 3(b): Create Informatica XML Source Qualifier Transformation Manually
To explicitly create XML Source Qualifier in Informatica, Please navigate to the Transformation menu in Menu Bar. Next, select the Create.. option
Selecting the Create.. option will open the Create Transformation window. Please select the XML Source Qualifier Transformation from the drop-down list and provide the unique name (XMLCustomers_SQ) for this transformation and click on Create button
That opens the Select Sources for Source Qualifier Transformation window. Click OK to select the xmlcustomer_records as the source.
Now you can see the same image that you have seen before
Double click on the XML Source Qualifier transformation to witness and alter the properties. Below screenshot shows you the list of available properties in the Transformation tab:
- Select Transformation: By default, it will select the transformation you chose (or clicked on).
- Rename: This button helps you to rename the XML Source Qualifier transformation name.
- Description: Use this space to provide a valid description of this transformation.
Below screenshot show you the available options in the Ports tab:
Next, Drag and drop the target definition (XMLCustomers) from the Targets folder to the mapping designer. Next, connect the XML source qualifier Transformation with the target definition. Please use the Autolink.. option to connect them.
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 Source Qualifier in Informatica
After you 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 example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.
It will open the Create Workflow window as shown below. Please provide the unique name (wf_XMLSource) and leave the default settings.
Once we created the workflow, our next step is to create a session task for our mapping.
Step 4(a): Create Session for XML Source Qualifier in Informatica
There are two types of sessions in Informatica:
For this example, we created a Non-reusable Session. To create Non-reusable Session, Please navigate to Tasks Menu and select the Create option as shown below.
Please provide a unique name for this session. Here, we are naming it as s_XMLSource. Once you click on the Create button, a new window called Mappings will open. Here you have to select the Mapping that you want to associate with this session, i.e., m_XMLSource.
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 connection by clicking on the XMLSQ_xmlcustomer_records present in the Sources folder.
- Source File directory: Informatica 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.
Next, we have to configure the target connection. So, select the XMLCustomers under the targets folder. Within the Connections, click on the Arrow button beside the Relational type, and select the target table database (Informatica Target)
Next, navigate to Workflows Menu and select the Validate option to validate the Workflow.
Now, Let me start the XML source qualifier transformation Workflow by selecting the Start Workflow option in Workflows Menu.