Datatable exporting

Good morning UiPath community,

I am currently working on a project where my final goal would be to download an XML file, read it into UiPath datatable, manipulate the datatable , then re-write the datatable back into an XML file.

I am able to do the following:
1- Download the file
2- Read file into a dataset
3- Convert dataset into datatable
4- manipulate datatable

I am currently having some issues converting the datatable back into an xml file. I know that the datatable object has a WriteXML method that we can use with an Invoke Method activity but for some reason I think that I am not calling the correct variables.

In the screenshot below, my parameter is a datatable that I have just manipulated. My method name is WriteXML method ( which is inherent to a datatable object). My target object is an XML variable that I want to eventually write to an XML file. the XML_Var is a variable of type System.IO.StringWriter.

When I try this, I get the error highlighted below. Any help on this would be appreciated.

@BotAM97,

Check this link for similar post with solution.

Hi @sarathi125 - thank you for your reply. I did look at that post and maybe I missed something but I am having a bit of troubler using the Invoke Method and WriteXML method and I can’t use any generic component from the UiPath Connect site due to regulatory requirements from our governance teams ( we are only allowed to use specific ones and these components are not approved).

This is why I was trying to use the “WriteXML” method because it’s a method that can be invoked on a datatable and does not require governance approval.

we can use writeXML method from datatable and it will create XML from datatable content
But in your case it sounds like you want to update existing XML with udpated datatable content, what is different. Did we get you right?

Hi Peter,

Well, the first part of the bot downloads an XML file and reads it into a UiPath datatable. I then perform a bunch of manipulations on the datable itself , and finally I want to write that datatable back into an XML because when I upload the file again, it needs to be in an XML format.

So yes, I do want to replace the downloaded XML with a new updated XML ( after I have manipulated the data)

writeXML maybe will not do this as it is creating its own structure based on col names.

How does the origin XML look like? Can you share some sample with us.
Often also stylesheet transformations can help on such cases.

also have a look here:
RnD_Writer2Xdoc.xaml (7.4 KB)