How to Extract XML File with Parsing

Hi All,

I want to extract the xml data from the given screenshot highlighted in yellow. How to extract the data from defining namespaces.


try to use “{ }” or if it’s dynamic which is like, “is dynamic”

XNamespace ab = “http://your-url”;
XElement tempElement = doc.Descendants(ab + “xlvalue”).FirstOrDefault();

this way it will look for an xmlns:ab=… section in your document to find out which namespace URI “ab” refers to.

You can get it by finding the attribute value for XNamespace.Xmlns + “ab”

XML Extraction - Handling Namespaces (Tableau, Soap, OASIS types) - Help / Community - UiPath Community Forum

1 Like

We have cleared the needed name space for p elements along with the text prefix

XNamespace preperation:

Retrieval of all p element content:


When I am doing xDoc.Root.Name

I am getting error as below.

we dont see error details?

Thanks for your PM

When interested on all 165 codes (we have multiples) it can be used as a filter criteria combined with regex

XML Deserialisation / Namspace preperation done as above shown

165CodeValuesList | List(of String) =

(From xe in xDoc.Root.Descendants(xnsText + "p")
let v = xe.Value
Let chk = System.Text.RegularExpressions.Regex.isMatch(v, "^\d+,165,")
Where chk
Select x = v).toList

as we already had shown above on how to extract all p elements values as a string list you can use / implement any filter logic for this.

When the xml elements are needed, then we would just modify the LINQ


When I tried to find xDoc.Root.Name in immediate, I got Exception Thrown by target of an Invocation.


looks like the breakpoint paused the deserialisation (it was not executed). Therefore xDoc is null, just use Step into and go 1 step forward



Still throwing error

show us the Deserialize XML Activity properties. xDoc is configured as output, right?

the following is ensured?

if this Deserialize XML is the last activity within the RnD Xaml, then just frag and drop an empty comment at the very end and retry. Feel free to share the xaml with us


Please find the xaml. Please help in the workflow of Data Extraction xaml. (2.4 KB)
il-bai2.xml (32.0 KB)

As mentioned

Did it (just modified the path to my specifics)

And got:

As it was the last sequence it was not working at your end, due all contexts were off / no longer accessible. Thats why we add the comment to have new last activity


Thank You so much. Next what are the steps I should include to extract the data (165 and subsequent data). Can you please help in adding the steps in the xaml file which I have send. It will be of great help.


Why you have taken 205 in xDOC.Descendants()(205).Name

because of randomly picking up a p element for the Namespace check


ok randomly we can enter any number like 205 or 206 etc to check Namespace .

xDoc.Root.Descendants(XMLText+“p”).Select(Function(x)x.Value).ToList(In this expression what we are doing )

I am again getting same error.

XMLText is not good variable name for a XNamespace variable

We showcased already the same here: