Deserialize XML file

Need below data from the XML tree.

Sub2 name and ID

FieldData name and type.

Could anyone please help to get these data.

@Palaniyappan
@vvaidya
@GreenTea

In general

  • read XML (e.g. read text file)
  • Deserialize XML - out: xDoc - UiPath.WebApi.Activities Package

grafik

We do see multiple Sub2 elements, we looped over it with a for each - TypeArgument: XElement
item = xDoc.Root.Descendants(“sub2”)

then access the values like:
item.Attribute(“name”).value
item.Attribute(“type”).value

for the fieldData let us know more about your business case and if you want to bring it within a particular output / target data structure.

Feel free to share with us a sample XML as text file

Hello, @Raju23c Have a look on the below video

Extract data from an XML

If possible, please share the sample XML

Thank you for your reply @ppr

I am able to get the descendants of the sub2 attributes now.

I have imported the XML file into excel, and below is the same.
My exact requirement would be the columns that I have highlighted in yellow.

it looks like you a familiar with XPath, is it?

Please share with us a sample XML as Text file. We will use it for our next solution suggestions. Thanks

SampleXMLFile.txt (773 Bytes)

Sure. Here is the sample XML file

Thanks for the reply @ushu
I tried this approach but the structure looks different in my XML so it’s not taking as .element attribute.

we can nest the loops and react when fielddata elements are present

grafik

Find starter help here:
ppr_XMLBox_Raju23c.xaml (14.4 KB)
SampleXMLFile.txt (773 Bytes)

@ppr Unable to download the xaml workflow that you have attached in the previous reply, could you please upload it again.

re-uploaded