Cant add multiple things to the same Xpath

Hello having a bit of a problem with Xpath i dont even know if Xpath would be the best to work with
so i have many invoices each invoice has a different amount of products so im trying to add in the same row the invoice number the product number and the price
some invoices have Many (up to 20 products) some have only one
i made an example of the invoice and the way i want to make it unfortunately on Xpath i need to do every single one by hand and if in the future the invoice comes with more than the number i set up that can end up causing problems so i want to know if there is a way of just adding all to the same column directly and also just get the amount of rows to be created directly from the Xpath
here an example of the XML
here how i would like to make it
and here is how im trying to make the Knime

thank you for any help

Hi @Bleck

Can you please share the example in the workable format? It’s quite a bit to manual type over :wink: It would also help if you can share a second dummy example of the situation you are describing with a different lay-out so that people can more effectively help you out with a solution.

There are some options available here, including searching for the tag name which does not require its position to be hardcoded.

1 Like

XML Coluna.knwf (44.7 KB)
35220703542091000266550020000106091367378495-nfe.xml (9.7 KB)
35220703542091000266550020000106101378192402-nfe.xml (8.0 KB)
Here is the Knime and the XML that im using as examples
so the idea is having a full column with the

then in front of each one of those a Invoice with its price

some invoices have a single one
and there is one that has 51 different products bought on it
i hope this explains and if its possible to do it as i need
thank you for your time

That works @Bleck!

You can get this done without loop:


In the XML reader, select Files in Folder and list the directory where all the xml’s all located. It will then load the contents of all files to be used.

With the Xpath node, create queries for the field you would like to have. Note: I don’t see yProd so I took vProd, the principle is the same. The trick here is to use wildcard and the Multiple Rows features.

The values of vprod are available through:



As such, if you then replace the fixed value of 1,2,3 with a wildcard it will automatically retrieve all data regardless of how many nItems you have. Same applies for the others fields.

Final query:

Select the Multiple Rows option in the query settings of each path.


Hope this helps!


it worked perfectly thank you very much

1 Like

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