Issue extracting XML node names or element name

One Star

Issue extracting XML node names or element name

We have experienced a Talend limitation which makes impossible to read / extract XML node name's value. In the example below we can not extract the name of the ini file which is an XML element i.e, APIUSER.INI, CISConsis.ini etc
<APIUSER.INI>
<Section Name="FILES">
<ROW FieldName="FILEPATH" Value="c:\API\BENCH\CWDATA.DAT"/>
</Section>
</APIUSER.INI>
<CISConsis.ini>
<Section Name="ConsisSettings">
<ROW FieldName="ServerIP" Value="192.168.10.161"/>
<ROW FieldName="ServerPort" Value="2040"/>
</Section>
</CISConsis.ini>
<CLAIM.INI>
<Section Name="Claim">
<ROW FieldName="Drive Letter" Value="a:"/>
</Section>
</CLAIM.INI>

The ROW and Section values mean nothing if INI file name is unknown and there is no way to transfer node names to a column value, like normal xml values or arguments.
There will be no problem in case of xml has correct arguments (or values) like

<CLAIM.INI Name=?CLAIM.INI?>
<Section Name="Claim">
<ROW FieldName="Drive Letter" Value="a:"/>
</Section>
</CLAIM.INI>

Can we get some help on this please.
Community Manager

Re: Issue extracting XML node names or element name

Hi
Sorry, I don't understand your point that you can't extract the value of node name.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Issue extracting XML node names or element name

Hi,
Try using the xpath name() function in your mappings. These screenshots show a job that defines a ROW loop. From the ROW loop, the field names and values are mapped directly using an attribute selector. The Section Name attribute is mapped using a relative path. The unknown Filename element is also mapped relatively, but uses the xpath function name() to get the name. Make sure that "Get Nodes" is checked. This may force you to define the property as built-in.
I wrapped the input XML in the original post in a root tag 'inifiles'.
This is from TOS, rather than TIS.
-Carl