473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

C# WEB: Convert TXT file to XML

1
I would like to convert plain txt files into xml. The text is comma separated with the first row containing field headings.

I would like to do this in C# to run in a Web Application.
I'll then display the contents of the newly formed XML file using GridView tool or similar.

I'd appreciate it if anyone can help me out with the txt -> xml conversion in C#

cheers
Aug 30 '07 #1
2 8632
Shashi Sadasivan
1,435 Expert 1GB
I would like to convert plain txt files into xml. The text is comma separated with the first row containing field headings.

I would like to do this in C# to run in a Web Application.
I'll then display the contents of the newly formed XML file using GridView tool or similar.

I'd appreciate it if anyone can help me out with the txt -> xml conversion in C#

cheers
You would have to do this manuallly i suppose.
read all the headers, and create respective nodes for their xml counterpart.

If yyou are unable to do it, send me a mail and i will try it
Aug 30 '07 #2
Shashi Sadasivan
1,435 Expert 1GB
hi obiman,
I dont know if you were able to do your task,
i fished for some data exporting stuff of mine and found what you want

Expand|Select|Wrap|Line Numbers
  1. string ConnectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=c:\draw1.txt";
  2.             OdbcConnection conn = new OdbcConnection(ConnectionString);
  3.             conn.Open();
  4.             OdbcDataAdapter da = new OdbcDataAdapter("Select * FROM draw1.txt", conn);
  5.  
  6.  
  7.             DSDrawing.DRAWINGDataTable dt = new DSDrawing.DRAWINGDataTable();
  8.  
  9.             DataSet ds = new DataSet();
  10.  
  11.             da.Fill(ds, "dbo.DRAWING");
  12.             ds.WriteXml(@"C:\outputfile.xml");
  13.             Console.WriteLine("Loaded");
  14.             conn.Close();
Hope this helps and is clear
Aug 31 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris Fink | last post by:
Should the web.config file be included in my deployment, IE physically located in the web app's virtual directory on a release? It makes me nervous having my DB conn string, etc in a ASCII file so...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
15
by: Joseph Geretz | last post by:
OK, I'll admit it up front - I just don't get it. Here's our previous VS2003 development model. Developers develop the WS solution on their own workstations, using their own IIS web servers...
2
by: robin | last post by:
When I convert my VS2003 Web Service project to VS2005, the file structure is changed automatically and application will no longer build because file location have changed. I've tried to move the...
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
7
by: Rick | last post by:
I have a web service that I converted from VS 2003 Framework 1.1. to VS 2005 Framework 2.0. I tried to use the same IIS web site to run the web service. I deleted the Framework 1.1 files published...
20
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
I was executing the steps given in http://suppor.microsoft.com/kb/308359 for testing a sample web service application. However, the following line gives a compilation error: localhost.Service1...
0
by: Samuel R. Neff | last post by:
We're migrating our .NET 1.1 web application to .NET 3.5 and during conversion we clicked "Convert to Web Application" on the web project. The results from this conversion were inconsistent. 1. ...
1
by: lds | last post by:
I have Visual Studio 2005 Professional Edition installed with Service Pack 1. I have several solutions and projects that I have migrated from Visual Studio 2003 to 2005. In most cases the changes...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.