Monday, October 12, 2015

Understand XPath syntax and Define Loop XPath Query and mapping XPath Query for tFileInputXML

In these days, XML source format is one of the mostly used source system for data integration. To handle XML format source file, depth understanding of XPATH is very important.
In this example illustrates, how to extract data from XML source file, and how to define XPATH for each required data. From this file, Monthly transaction needs to extract such as Month, Value, and Branch.
First this is, define the Loop XPath query. Month, value and Branch will be loop data, so LOOP XPATH:
Loop XPath query:
"/Account/LEVL1/LEVEL2/LEVEL3/LEVEL4/LEVEL5/MonthlyTransaction"


Source File:
Expected Output:
XPATH for mapping as per output requirement:
* You can not call another Loop elements in the same tFileInput , you should use another tFileInput with the separate XPath Loop query. After that using tMap use can join and bring them into same flow.

* Loop element's properties can be call such as "Branch/@id"

XPath syntax elements for XML file:
XPath
Description
/
the root object/element
.
the current object/element
/
child operator
..
parent operator
//
Recursive descent.
*
Wildcard. All objects/elements regardless their names.
@
Attribute access.


Cheers! Uma

3 comments:

  1. I have been trying to do the same in Talend, but i do not get the mappings. Did you edit the schema? and Did you manually add the Mappings?

    ReplyDelete
  2. Is this blog still active? tFileInputXML has now a different behaviour? The XPath keyworkds seem no longer work..

    ReplyDelete