How to read xml data into datatable

Hi Team,

I have a xml file , that i have to convert in datatable. Any idea how we can do that.


depending on the xml structure:

  • LINQ / XML Apis
  • .Net DataTable Method: ReadXML (But requires a dedicated element structure)

Maybe you can share some sample xml with us

Hi @Hitesh1

First build a datatable using build datatable activity for your output value

Read the xml and deserialize that xml data using deserialize xml activity

Use for each to iterate deserialized xml data and set type argument as System.Xml.Linq.Xelement

Then pass the in argument value as deserializedvariable.Descendats("enter the parent tag name of desired tag ")

Finally use add data row activity inside the for activity to add values into datatable pass the xml data into array like {item.Element(“your desired tag name 1”).value,item.Element(“your desired tag name 2”).value} and pass the build datatable output variable into datatable tab

Thats it

We converted xml data into datatable

Hope its solves your issue