Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
KiranGer
Contributor
Contributor

How to loop and retrieve data based on attribute value of an element

I am new to Talend. I am designing a job to parse xml data. tFileInputXML -> tXMLMap -> tLogRow

I have an part of xml like this below.

<Items>

    <anyType xsi:type="Convector">

      <Name>Base</Name>

      <Weight>1125</Weight>

      <OuterDiameter>2</OuterDiameter>

      <InnerDiameter>0.61</InnerDiameter>

 </anyType>

 <anyType xsi:type="Coil">

<Status>Placed</Status>

      <Version>1</Version>

    <Type>Strict</Type>

</anyType>

    <anyType xsi:type="Convector">

      <Name>Convector 1</Name>

      <Weight>1174</Weight>

      <OuterDiameter>2.2</OuterDiameter>

      <InnerDiameter>0.93</InnerDiameter>

 </anyType>

 <anyType xsi:type="Coil">

<Status>NotPlaced</Status>

      <Version>2</Version>

    <Type>NotStrict</Type>

</anyType>

</Items>

Could some one tell me how i can loop anyType in tXMLMap based on xsi:type = "Convector " or "Coil" and retrieve its child values. i.e If anytype xsi:type = "Convector" then loop

Name, Weight , OuterDiameter, InnerDiameter values and log in tlogRow1 and If anytype xsi:type = "Convector" then loop status, version, type values and log in tlogRow2.

Thanks for the help in advance.

Labels (3)
2 Replies
tnewbie
Creator II
Creator II

From what I understand, In tXMLMap, set your sourceloop to </anytype>, in the next tmap split the data based on the xsi:type

KiranGer
Contributor
Contributor
Author

Can you tell me how do I split the data based on type ?