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:
<root>
<subtag1>
<id>1</id>
<value>Apple</value>
<id>2</id>
<value>Mango</value>
</subtag1>
<subtag2>
<id>1</id>
<value>Banana</value>
<id>2</id>
<value>Orange</value>
<id>3</id>
<value>Kiwi</value>
</subtag2>
<subtag3>
<id>1</id>
<value>Grapes</value>
</subtag3>
</root>
Expected CSV Output:
1|2,Apple|Mango
1|2|3,Banana|Orange|Kiwi
1,Grapes
Any workaround to achieve same? Please suggest.
Thanks in advance.