How to create/generate XML out of datatable

studio
xml

#1

Friends,

Please guide me as to how do I create XML file out of datatable that I build run time.

Thanks
Manoj


Datatable to XML
#2


#3

Thanks vvaidya for quick response and help. I am getting following warning/error. Could you please guide me whether I am doing anything wrong? Also please note that Arguments Panel picture that I see in your example and one I get on “UiPath Community Edition” is different. Is that an issue?

Thanks
Manoj


#4

“sw” should be passed as a parameter in Invoke method properties, you passed it as an argument


#5

Thanks buddy, that worked.

I missed asking, how do I put it a particular format of XML nodes and how do I write it to a file to create xyz.xml?

Thanks again
Manoj


#6

Might look complex with all those Invoke Methods (but not), let me know if it works.

dt2Xml-1.xaml (11.3 KB)


#7

This was AWESOME! Thanks for the project file!


#8

Hi Vaidya,

How you doing?

Few hurdles in creating XML, if you could help me out on this one.
I need to create XML tag as,

image

Thanks
Manoj


#9

XML Naming Rules

XML elements must follow these naming rules:

Names can contain letters, numbers, and other characters
Names cannot start with a number or punctuation character
Names cannot start with the letters xml (or XML, or Xml, etc)
Names cannot contain spaces
Any name can be used, no words are reserved


#10

Thanks a lot buddy.


#11

Hi All,

Have done some trials on DataScapping/DB/Excel interaction etc…so far.
Have a typical issue of creating XML…I found this item on forum and felt very similar to my issue.
i prefer to keep the tags and values in Excel.(I assume file - file123.xlsx in the example is for this purpose).
What is the sample format of my Excel (in terms of nodes and values)?
what are the packages i should import in order to work the attached file smoothly?
(I do not see the most of the methods in the activity list).
invokemethod() function definitions - Should I do any programming ( for WriteStartDocument/WriteStartElement…etc) or just use the thread as it is…?
Am a BA with minimum programming skills…
I was able to understand that pgm reads the sheet1 of the file and store into datatable. Subsequently loops thru the DT and do the XML processing.
pls help me on this…btw, can you pls share tutorial , if any available.

Thanks in advance.
ASJ/Asha


#12

For me it’s not writing anything.:frowning:


#13

Hi @vvaidya ,
While creating xml I am getting some extra attributes like xmlns xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:xs=“http://www.w3.org/2001/XMLSchema” xsi:type=“xs:string”

How I can remove this.?


#14

Hi,
I need to create an xml file, based on multiple columns in database/excel/datatable.
But unable to find a solution. I have tried above steps, but getting an error for WriteXML method. Have also added Activities required for xml. Please suggest on how to resolve it.