Link to home
Start Free TrialLog in
Avatar of vishwanadhamjella
vishwanadhamjella

asked on

I need to convert a csv file(size is 60 mb) to xml file in my application developed in C#.

I would like to convert .csv file of size 60 mb  into xml file.

So, how can i do it in c# code.

Could you send sample code to get it work.

Thanks in advance.

jella
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

Well, if you're happy to use any method to get the job done, then here's an existing program which does it for you (it's in Java mind you):
http://www.filehungry.com/english/product/windows_software/utilities/file_converters/my_csv_to_xml_converter


Alternatively, read each line in the CSV file into a string, use the Split() method to tokenize the string (with the delimiter set to ","), and then use the XmlTextWriter class to write the data to an XML file:
http://www.filehungry.com/english/product/windows_software/utilities/file_converters/my_csv_to_xml_converter
Sorry, clearly the URL for the XmlTextWriter class had not been copied to my clipboard properly; here it is:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemxmlxmltextwriterclasstopic.asp
ASKER CERTIFIED SOLUTION
Avatar of blackbrocoli
blackbrocoli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial