473,395 Members | 1,679 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,395 software developers and data experts.

converting .xml to a comma delimited text file

Is there a way to convert or copy a .xml file to a comma delimited text file
using vb .net?

Thanks for any help.

Bernie Yaeger
Nov 20 '05 #1
9 3598
Hi Bernie,

A document or an dataset?

Cor
Is there a way to convert or copy a .xml file to a comma delimited text file using vb .net?

Nov 20 '05 #2

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is there a way to convert or copy a .xml file to a comma delimited text file using vb .net?


That's an extremely vague question. Could you provide more detail,
specifically what the XML currently looks like and what you want the CSV to
look like?
Nov 20 '05 #3
>
That's an extremely vague question. Could you provide more detail,
specifically what the XML currently looks like and what you want the CSV to look like?

Is that a question Jeff, when you have a XMLdocument you have to use the
xmlReader and when it is a dataset you can use the readXML.

That is the only important point in my opinion.
For the last one I have a simple generic sample.

By the way Bernie is a very regular to this dotNet newsgroup he helps often.

Cor
Nov 20 '05 #4
Hi Jeff,

Tx for your reply.

I am trying to take a table within a dataset and get it into a comma
delimited .txt file. If I try to do this with a stream or textstream using,
say, a 25000 row table, it takes quite some time. If I use the writexml
method, it's incredibly fast. So I thought - what if I first write it to
xml and then convert it? Ultimately, what I need is a comma delimited
textfile (.txt). Doing the same thing in .csv using interop and the Excel
object, it also takes far too long.

Thanks for any help.

Bernie

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:eI**************@TK2MSFTNGP10.phx.gbl...

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is there a way to convert or copy a .xml file to a comma delimited text file
using vb .net?


That's an extremely vague question. Could you provide more detail,
specifically what the XML currently looks like and what you want the CSV

to look like?

Nov 20 '05 #5
Hi Cor,

Nice to hear from you again.

The answer is a document, but let me explain more thoroughly.

I am trying to take a table within a dataset and get it into a comma
delimited .txt file. If I try to do this with a stream or textstream using,
say, a 25000 row table, it takes quite some time. If I use the writexml
method, it's incredibly fast. So I thought - what if I first write it to
xml and then convert it? Ultimately, what I need is a comma delimited
textfile (.txt). Doing the same thing in .csv using interop and the Excel
object, it also takes far too long.

Thanks for any help.

Bernie
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Bernie,

A document or an dataset?

Cor
Is there a way to convert or copy a .xml file to a comma delimited text

file
using vb .net?


Nov 20 '05 #6
What about using XSLT on the xml that you have? I know XSL is notoriously
slow, but it still be a lot faster then just writing it and formatting it
manually.

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi Cor,

Nice to hear from you again.

The answer is a document, but let me explain more thoroughly.

I am trying to take a table within a dataset and get it into a comma
delimited .txt file. If I try to do this with a stream or textstream using, say, a 25000 row table, it takes quite some time. If I use the writexml
method, it's incredibly fast. So I thought - what if I first write it to
xml and then convert it? Ultimately, what I need is a comma delimited
textfile (.txt). Doing the same thing in .csv using interop and the Excel
object, it also takes far too long.

Thanks for any help.

Bernie
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Bernie,

A document or an dataset?

Cor
Is there a way to convert or copy a .xml file to a comma delimited
text file
using vb .net?



Nov 20 '05 #7
Hi Marina,

Tx for your response. I'll try it.

Tx again,

Bernie

"Marina" <so*****@nospam.com> wrote in message
news:O3****************@TK2MSFTNGP10.phx.gbl...
What about using XSLT on the xml that you have? I know XSL is notoriously
slow, but it still be a lot faster then just writing it and formatting it
manually.

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi Cor,

Nice to hear from you again.

The answer is a document, but let me explain more thoroughly.

I am trying to take a table within a dataset and get it into a comma
delimited .txt file. If I try to do this with a stream or textstream

using,
say, a 25000 row table, it takes quite some time. If I use the writexml
method, it's incredibly fast. So I thought - what if I first write it to
xml and then convert it? Ultimately, what I need is a comma delimited
textfile (.txt). Doing the same thing in .csv using interop and the Excel object, it also takes far too long.

Thanks for any help.

Bernie
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Bernie,

A document or an dataset?

Cor

> Is there a way to convert or copy a .xml file to a comma delimited

text file
> using vb .net?
>



Nov 20 '05 #8
Hi Bernie,

Now I do not understand it anymore, you want to write a table and than read
it

Here is my sample. See what you can do with it.
\\\\
Dim sw As New IO.StreamWriter("C:\Bernie.csv")
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
Dim row As New System.Text.StringBuilder
row.Append("""")
For y As Integer = 0 To ds.Tables(0).Columns.Count - 1
row.Append(ds.Tables(0).Rows(i)(y).tostring)
If y <> ds.Tables(0).Columns.Count - 1 Then
row.Append(""",""")
' if you want it with a tab
' row.Append("""")
' row.Append(chr(09))
' row.Append("""")
Else
row.Append("""")
End If
Next
sw.WriteLine(row.ToString)
Next
sw.Flush()
sw.Close()
///
Nov 20 '05 #9
Hi Cor,

Thanks for the sample - I'll give it a try!

Bernie
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:Or*************@TK2MSFTNGP11.phx.gbl...
Hi Bernie,

Now I do not understand it anymore, you want to write a table and than read it

Here is my sample. See what you can do with it.
\\\\
Dim sw As New IO.StreamWriter("C:\Bernie.csv")
For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
Dim row As New System.Text.StringBuilder
row.Append("""")
For y As Integer = 0 To ds.Tables(0).Columns.Count - 1
row.Append(ds.Tables(0).Rows(i)(y).tostring)
If y <> ds.Tables(0).Columns.Count - 1 Then
row.Append(""",""")
' if you want it with a tab
' row.Append("""")
' row.Append(chr(09))
' row.Append("""")
Else
row.Append("""")
End If
Next
sw.WriteLine(row.ToString)
Next
sw.Flush()
sw.Close()
///

Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Arne | last post by:
From: "Arne de Booij" <a_de_booij@hotmail.com> Subject: Comma delimited array into DB problems Date: 9. februar 2004 10:39 Hi, I have an asp page that takes input from a form on the previous...
3
by: Elmo Watson | last post by:
I've been asked to develop a semi-automated type situation where we have a database table (sql server) and periodically, there will be a comma delimited file from which we need to import the data,...
1
by: Bernie Yaeger | last post by:
Is there a way to convert a .xml file to a comma delimited text file using vb .net? Thanks for any help. Bernie Yaeger
1
by: DCM Fan | last post by:
Access 2K, SP3 on Windows 2K, SP4 All, I have an import spec set up with quoted Identifiers and comma-separated values. The text file is produced by a 3rd-party program of which I have no...
1
by: John B. Lorenz | last post by:
I'm attempting to write an input routine that reads from a comma delimited file. I need to read in one record at a time, assign each field to a field array and then continue with my normal...
2
by: Kenneth Koski | last post by:
Hello All, I have a comma delimited text file, which I would like to move into a SQL 2000 table . I created a DTS package in SQL Server and saved it as a VB.bas . I am writting the code in C#...
5
by: Yama | last post by:
Hi, I am looking to create a report comma delimited on a click of a button. Explanantion: 1. Get from the database: "SELECT * FROM Customers WHERE Region = 'CA'" 2. Use either DataReader or...
3
by: Avi | last post by:
I need to create a text file that has the data from the 10 tables in the database. The number of fields in the tables exceeds 255 and so I cannot make a new table with all the fields and then...
4
by: JustSomeGuy | last post by:
Hi. I have a comma delimited text file that I want to parse. I was going to use fscanf from the C library but as my app is written in C++ I thought I'd use the std io stream library... My Text...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.