Reading XML - Issue with main element and for each

Hello everyone,

I am trying to read some XML files and write the data into an Excel spreadsheet. My issue is arising when trying to do a For Each statement. In the screenshot attached, my issue is with the first line that begins with “form”. When I try to reference this in my for each I get errors. How can I do this correctly? The end portion (.Elements(“field”)) is correct, but I do not know what to put in the Element(“”) part before it. My workflow is also attached in the zip file. Any help is greatly appreciated!!

ReadingXML.zip (3.3 KB)

@luke.etnier
welcome to the forum

the xml is defining namespaces. Have a look below on how to handle

Peter,

Thank you for the reply. This worked and I was able to get the first set of Name and Values (HowWillProjectBeFunded and Forecast in screenshot below). However, I need to get all of these from the XML file. There are multiple and all are listed inside a element. How can I make sure that it gets all of them and not just the first pair?

xaml file is attached for reference.


Main.xaml (9.3 KB)

give a try on following:

you need to loop over all fields, then you can access e.g the field name

Peter - thank you for the reply. This was a bit of a side project at my job and I have had to switch my focus to something else for the time being. As soon as I have time to test this out I will do so and mark it as the solution if all goes well. Thanks again for the assistance.

FYI Excel can directly import XML files. You’d have to treat it like a regular application and Use Application/Browser then click around in Excel, but that’s doable.

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