XML loop through elements and nodes


Let say my XML is that structured


What i want to get is loop through every positio> and every id/name

I tried something like that:

So i wanted loop through positions and than every node in it, but it is not working :frowning:

Hi @Add_Bddd ,

  • Use UiPath.WebAPI.Activities
  • Deserialize the string using “Deserialize XML” activity and get the output in a variable “varXMLData”

To get all the elements use below code


To get specific node use below code


I had to use “node.Descendants” in second loop instead of node.Nodes. Now it`s working :slight_smile:

xDoc.Root.Elements(“position”) used for the loop

1 Like

Thank you @ppr, however i do not have that option ( community version uipath )


you do have. Just show us what you have done so far and what is not working

It is working now, i have just changed node.Nodes to node.Descendants (from 1 post screenshot)

First loop :
For each node in document.Element(“main”).Elements(“positions”)
Second loop:
For each item in node.Descendats

Now it is looping through every position element and every one inside it.

Was just curious about yours method, however i do not have “Values” field in For Each properties

check your imports for following namespaces:

List of Items is just a renaming of Values when working with a newer version of the package

@Add_Bddd Try this video