Select multiple xml tags and iterate

i have xml data of below type

i wan to iterate for every tag and capture the and tags.

appreciate your responses.

iterate every “a” tag and capture “b”, “c” tags and store in a variable

Hi there @bsamala


Here is a small snippet for your VB.NET code

Dim document As New XmlDocument()
Dim nodelist As YourXmlNodeListAsOutArgument = 

Above snipped should have the correct dependency imports in the variables section (Check imports for an existing dependency)

  1. Have your xml file ready.
  2. Import dependency and replace/edit code as required for your convenience.
  3. Create an out argument that captures the IEnumerable list of nodes that comes out of the code snippet.
  4. Iterate through the nodes and check for the tags.


You can import the xml file and de-serialize it using an inbuilt activity ( and then iterate through it with either for-each loop or using a xpath expression (XML and XPath).

Hope this helps :slight_smile:


1 Like

@bsamala in Case of you face any issues due the xml ist using namespaces have a Look Here

1 Like

Hi @Raghavendraprasad,

i haven’t tried with but gave a try with xpath expression. i used xpath expression activity and given string as input. but problem here is very first tag has url in it so it’s not accepting special character(for me it has thrown invalid special character “:” so i tried replacing with ascii values nothing helped). If you don’t mind can you get ne xpath expression for above xml? which has to iterate for every “a” tags and capture “b” and “c” tags.

@bsamala the : issue comes from the soap namespaces Name. In my xaml you can See a workaround with using the namespaces information. I would suggest to Analyse what is the Name of the a element (is IT with or without namespace) and maybe do the Combinaton of both (linq and xpath) Access methods


I don’t remember all the syntax either but here are a few common ones I ahve compiled a bit of trial and error should give you a precise result. And any schema that has special characters xpath doesn’t work properly (not an expert on why it doesn’t work or about inner workings/mechanism on how it is queried…) Hope this helps :slight_smile:


selects all the elements in the document.


selects all elements, text nodes, processing instructions, comment nodes, and the root node / .


selects all text nodes in the document.


selects all comment nodes in the document.


selects all processing instructions in the document.


selects all attribute nodes in the document.


selects all namespace nodes in the document.

Finally, you can combine any of the above expressions using the union ( | ) operator.

Thus, I believe that the following expression really selects “all the nodes” of any XML document:

/descendant-or-self::node() | //@* | //namespace::*

Get back to me if xpath doesn’t work and we have to take the route and if the code supplied by me doesn’t work as expected :slight_smile:


PS : References : Stack overflow compilation. I haven’t personally tested every single one of the commands above except a few.