Hi Team,
I have a xml file , that i have to convert in datatable. Any idea how we can do that.
Thanks,
Radha
Hi Team,
I have a xml file , that i have to convert in datatable. Any idea how we can do that.
Thanks,
Radha
depending on the xml 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
Thanks
Robin
Follow below steps
Step 1: read XML file and assign to varible as system.Xml.Linq.Xdocument.
Step 2: build datatable
Step 3: Assign datatable variable(Which is created in step 2)with below LINQ Query
Comment: change the values in the query accordingly
(
From el In Xdoc.Descendants(“book”)
Let id = CStr(el.Attribute(“id”))
Let author = CStr(el.Element(“author”))
Let title = CStr(el.Element(“title”))
Let price = CDbl(el.Element(“price”))
Select out_dt.Rows.Add({id,author,title,CDbl(price)})
).copytodatatable
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.