Select only some parts of XML code

Hey all,

I’m reading a text file which has XML contents
I mean it is XML file saved with .txt extension for readability.
I have to read only some parts of the whole file.
Does any one know how to clean the XML file for the desired contents?

Thanks in Advance!


The file has a structure? Or is random?

If you have the file with a static structure, you can try to find the trigger and after proceed to extract the rows

It’s structured.
And I didn’t follow you after that


Can you share an example file?

1 Like

as it is XML Retrieval via the provided XML Apis can help to do it with minimal effort. Sharing of representing sample data will help us for further solution suggestions.

1 Like

sorry for the delay.


This is an dummy example, Now in this I don’t want to use the ex tag .
I don’t want to use the header as well i.e.

<?xml version="1.0" encoding="54545"?>

Any solution??
Thanks in advance!

1 Like

A good pattern here in the forum is: showing input (is done above), giving expected output sample with a clear description and then we can setup a individually solution approach very fast.

Hey @ppr,

I just want to remove the ex tag and the header as I mentioned.


when it is only about this then RegEx replace will help.

replace with an empty string: “”

Pattern for the xml:


Pattern for the ex tag:




hay @ray_sha

Let see:

  1. Orignal data:
  2. Output data:

if so, let me know to share with you an main file as example.

I just want to remove the ex tag and the header.
The output data must have everything expect the header and the ex tag



I’ll try this approach but dont we have any XML activity for the same?



is bit confused for me now :smiley:
(you said “I wand to remove”, for me is that you wand extract, I’m right?
Let try again, your output expected is this:

Hey, I apologize for the confusion.
This is the desired Output




Some more clarity on this?

Thanks in Advance


Please, find the output 100% accordingly with your request: (20.8 KB)

if this was a solution, please mark as.

with the UiPAth.WebAPI.Activities Package we do get some activities to read in XML text into a so called XDoc. With the methods from System.Linq.XML namespace we can use several methods for XML Processing:

In your case you want to remove the header/Prolog and 1 tag. Still same recommendation: Can be done the regex replace.

Thank you
@VB_THA, @ppr

@ray_sha welcome,

Happy automations :slight_smile:

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