How to transform XML data to a table

Just execute it if your XML files are in “C:\Users\Bunel\knime-workspace\Test2”.
If the path to the folder which contains the XML files is correct, then just ignore the error and execute the workflow and should work. In this case, the error appears since the List Files and the Table Row To Variable Loop Start nodes are not executed and there is no variable for “Input location”.

But if the error appears even after executing the previous nodes, then you have entered a wrong path to the folder. Do you have your XML files in “C:\Users\Bunel\knime-workspace\Test2”?

1 Like

It works well now. Thank you

1 Like

I still have a problem with an XML file. Apparently, it is well structured (I tried with Oxygen) but it is not recognize in KNIME. Even if I use a very eazy workflow like XML reader–>Xpath, when I try to create a Xpath query, it tells me that XML elements are not attributes or tags. I don’t know if it a file problem or KNIME problem. Could you please try to help me? PLease find my file here.univ-rouen-irihs.xml (3.6 KB)

Thank you

The XML file looks normal at the first glance but if you investigate further, there are line separator characters (ls) in some attributes and that’s the problem. So you have to use the String Manipulation node with the expression below (which will look like there is nothing inside double quotes when you paste it), then use the String to XML node and finally the XPath node.

EDIT: It seems the expression with the line separator character cannot be displayed here. So I share the workflow with the String Manipulation node included. The expression looks like this:
regexReplace($XML$, "", "")
But actually there is the ls character inside the first pair of double quotes.

You can use this sequence in a loop in your workflow. It has no side effects or impact on healthy files.

magic_regex.knwf (30.0 KB)

:blush:

2 Likes

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