How do I bring repeating tags from an XML file into a single table cell?

In my xml file, which I want to bring into a table, there are recurring tags under the same parent tag. So these values should be in the same table cell.


But how can I do this? All the options in the XPath node puts the contents in separate rows or columns.


If I want to have the values in a cell, the values of the next parent tags with the same name also go into this cell. So how does that work?

Hi @Thoralf

Welcome to the KNIME Community!

This can be achieved with the correct sequence of XPath query’s. This could also require some Ungroup nodes afterwards. Based on your screenshot it seems that you have multiple instances of <RightsStatement>

If you are able to share that xml showing your use case in a workable format then users are generally more inclined to help you out with a proper solution :wink:

This could be starting point:


Creates Nodes based on RightsController/RightsStatement

Then query the StartDate and Territory accordingly in a second Xpath node.

1 Like

Hey @ArjenEX
realy thanks for your replay! I really appreciate that.
And yes, if I also release the XML file, anyone can participate in this topic. So this is the example file:
DeclarationOfSoundRecordingRightsClaimMessage_00001.xml (18.4 KB)

It’s the same data set appended four times. This results in 4 table rows with the same values. Everything worked perfectly for me. Except for this tag

4 lines were created from 4 values per parent tag. All other values had missing values, because only one value could be read from each tag. The four data records, which should actually correspond to 4 rows in the table, were inflated to 16 rows. 12 of them with missing values. See the picture above.

With your suggestion, the values from the repeating tags unfortunately end up in extra rows again. However, the respective value is now transferred to the other rows so that there are no more missing values.


But I need all values in a single table row. This XML file should therefore have 4 lines with one value each. Except in the RightsTerritory column, there should be 4 comma-separated values: BB, TT, PY, EC. In each of the 4 lines.

Is that somehow possible?

Your description is somewhat hard to follow. Is this what you’re looking for?


1 Like

Yes! How you got it?

Pretty similar approach to be honest. The trick here is to extract an CollectionCell for the Territory’s and then do some final processing thereafter. You can skip this last part depending on your specific use case.

See WF:
repeating tags from an XML file into a single table cell.knwf (24.7 KB)


Hey @ArjenEX, thank you very much! In the end, if you know how it works, it’s actually easy.

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