One Star

Help to to read data from xml file with attribute

Hi- Below is the content of my xml file and I have to load it into relational table and should look like below
VAR_NAME CATEGORY TABLE NAME COL NAME
Trip Frequency Trip TMP_AGG_FIELDS_STORE Trip_Frequency
Avg Departments Per Trip Trip TMP_AGG_FIELDS_STORE Avg_Depts_Per_Trip
Avg Item Value Item TMP_AGG_FIELDS_STORE Avg_Item_Value

XML file: My question how I can get attribute values defined in xml file and use in the job flow.
<aggvariablesdefinition>
<avtable avtablename="F_AGG_VAR_TRIPS_STORE">
<aggvariables aftablename="TMP_AGG_FIELDS_STORE">
<aggvariable avname="Trip Frequency" category="Trip" columnname="Trip_Frequency"/>
<aggvariable avname="Avg Departments Per Trip" category="Trip" columnname="Avg_Depts_Per_Trip"/>
</aggvariables>
<insertsql truncate="yes"> Abc</insertsql>
</avtable>
</aggvariablesdefinition>
Thanks,
1 REPLY
Moderator

Re: Help to to read data from xml file with attribute

Hi,
First of all, you should make sure your XML file is well-formed and then you can use talend componenttInputXML to retrieve your attribution into relational table.
Here is the related forums: Forum 12624
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.