Handling dynamic number of tags in XML to CSV conversion

Hello there,
I’m new to Knime. I was trying to convert one XML file to CSV file. I’m using XML Reader, then XPath to configure the tags and then using CSV Writer to create a CSV file.
I’m facing problem in case of dynamic number of tags in XML file. Say, in 1st sub-tag of root node, there are 2 Ids used, and in second sub-tag of root node, 3 or 4 Ids are used. These sub-tags have same names. When tried to use Multiple rows/Multiple Columns/Collection Cell, i’m not getting what I wanted exactly. Below is an example of XML input and expected output in CSV:

XML Input:

Expected CSV Output:

Any workaround to achieve same? Please suggest.
Thanks in advance.

Hi @farooquedharwad and welcome to the KNIME forum,

You can first use an XPath node to extract each “subtag” as a node cell value and then extract "id"s and "value"s of each “subtag” with another XPath node. Then you can use the GroupBy node to aggregate the results.



This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.