Search code examples
etltalend

Counting the number of tags in input XML file using talend


I am reading the data from XML file using tFileInputXML.Each row of data is present in the one element like <data columnName="[value]"/>. I want to count number of data tag in the XML using Talend tool. If there are more than one tag then only i want to proceed the operation of inserting to table.How can i achieve this is talend.


Solution

  • Try tFileInputXML->tJavaRow->tHashOutput In tJavaRow, add 1 to a global var for each row. Now you can a subjub (onSubjobOk) with tJava->if->tOracleOutput (or other). For the "if" the condition should look like (Integer)globalMap.get("yourVariable") > 1

    Hope this helps TRF