473,385 Members | 1,523 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.

Flat File To XML Roundtrip

OK I'm on a steep learning curve with XML et.al. and need some advice.

I'm writing a B2B front door for a new application. I have multiple
data suppliers all sending various formats of flat files. Most of the
inbound files are CSV (but a couple are tab-delimitted and one is an
Excel spreadsheet). The goal is to read/process/validate each file and
to "transform" the data into a common, internal, file format which
will by sent on to a downstream application for final processing and
consumption. I'm using VB.Net 2003 as my development platform.

My novice approach to do this will be to:

1) Convert each inbound file to XML (hopfully using some
template-driven parser). I'd like to maintain x number of
file-descriptor templates but use common code to convert the flat
files.

2) Use XSLT to transform the new inbound XML file into the output
target file format

3) Load the XSLT-transformed file (now having the desired outbound XML
format) into a DataSet (for validation and processing)

4) Write/Convert the validated contents of the DataSet to the output
flat file.

My Question is...

Does this sound like a good approach? and are there any good how-to
examples which address these steps? I need to get the job done but I'm
also wanting to use this as a good training exercise in .Net and XML.

Thanks in advance for your input!
Nov 12 '05 #1
6 5534
In there user samples on www.gotdotnet.com you will find an XmlCsvReader
which may be of some help to you for step (1).

Converting the DataSet back to XML is easy, then from XML back to CSV can be
done with an XSL transform, which I think is included in teh XmlCsvReader
download.

So yes, this approach makes sense. A lot of folks are standardizing on XML
for this kind of processing. Hopefully eventually, you'll be able to
convince your business partner to just send you XML at some point in the
future, and then you're processing will get a bit more streamlined.
"Glenn Owens" <go****@nixonpeabody.com> wrote in message
news:bc**************************@posting.google.c om...
OK I'm on a steep learning curve with XML et.al. and need some advice.

I'm writing a B2B front door for a new application. I have multiple
data suppliers all sending various formats of flat files. Most of the
inbound files are CSV (but a couple are tab-delimitted and one is an
Excel spreadsheet). The goal is to read/process/validate each file and
to "transform" the data into a common, internal, file format which
will by sent on to a downstream application for final processing and
consumption. I'm using VB.Net 2003 as my development platform.

My novice approach to do this will be to:

1) Convert each inbound file to XML (hopfully using some
template-driven parser). I'd like to maintain x number of
file-descriptor templates but use common code to convert the flat
files.

2) Use XSLT to transform the new inbound XML file into the output
target file format

3) Load the XSLT-transformed file (now having the desired outbound XML
format) into a DataSet (for validation and processing)

4) Write/Convert the validated contents of the DataSet to the output
flat file.

My Question is...

Does this sound like a good approach? and are there any good how-to
examples which address these steps? I need to get the job done but I'm
also wanting to use this as a good training exercise in .Net and XML.

Thanks in advance for your input!

Nov 12 '05 #2
In there user samples on www.gotdotnet.com you will find an XmlCsvReader
which may be of some help to you for step (1).

Converting the DataSet back to XML is easy, then from XML back to CSV can be
done with an XSL transform, which I think is included in teh XmlCsvReader
download.

So yes, this approach makes sense. A lot of folks are standardizing on XML
for this kind of processing. Hopefully eventually, you'll be able to
convince your business partner to just send you XML at some point in the
future, and then you're processing will get a bit more streamlined.
"Glenn Owens" <go****@nixonpeabody.com> wrote in message
news:bc**************************@posting.google.c om...
OK I'm on a steep learning curve with XML et.al. and need some advice.

I'm writing a B2B front door for a new application. I have multiple
data suppliers all sending various formats of flat files. Most of the
inbound files are CSV (but a couple are tab-delimitted and one is an
Excel spreadsheet). The goal is to read/process/validate each file and
to "transform" the data into a common, internal, file format which
will by sent on to a downstream application for final processing and
consumption. I'm using VB.Net 2003 as my development platform.

My novice approach to do this will be to:

1) Convert each inbound file to XML (hopfully using some
template-driven parser). I'd like to maintain x number of
file-descriptor templates but use common code to convert the flat
files.

2) Use XSLT to transform the new inbound XML file into the output
target file format

3) Load the XSLT-transformed file (now having the desired outbound XML
format) into a DataSet (for validation and processing)

4) Write/Convert the validated contents of the DataSet to the output
flat file.

My Question is...

Does this sound like a good approach? and are there any good how-to
examples which address these steps? I need to get the job done but I'm
also wanting to use this as a good training exercise in .Net and XML.

Thanks in advance for your input!

Nov 12 '05 #3
"Chris Lovett" <chris@!nospam!.net> wrote in message news:<10*************@corp.supernews.com>...
In there user samples on www.gotdotnet.com you will find an XmlCsvReader
which may be of some help to you for step (1).

Converting the DataSet back to XML is easy, then from XML back to CSV can be
done with an XSL transform, which I think is included in teh XmlCsvReader
download.

So yes, this approach makes sense. A lot of folks are standardizing on XML
for this kind of processing. Hopefully eventually, you'll be able to
convince your business partner to just send you XML at some point in the
future, and then you're processing will get a bit more streamlined.

Chris, thanks for the response. I am currently looking at the
XmlCsvReader - it definitely looks like something that I could use.
Thanks for your hard work and pointing me in this direction.

Can it be modified? (it does appear to be copywritten)...

Is there a way to use an .XSD file to describe/interpret the column
tags instead of using the first line of the file to define the column
names (tags)? This would allow me to fully describe any of the input
files, using separate schemas, without needing to modify them before
the initial XML conversion. The added bonus would be to use the .XSD
files to validate the structure, datatype, cardinality, etc. - could
the XmlCsvReader descend from XmlValidatingReader?

Also, I came across a really good MSDN link article on customizing the
XmlReader:

http://msdn.microsoft.com/webservice...ustxmlread.asp

You are correct about the furture of our B2B. This is just the first
step before we "potentially" begin requesting each of our data vendors
to supply well-formed XML input streams (preferably via a web
service). But, we needed to get this part done reasonably quickly.

Thanks again,
Glenn
Nov 12 '05 #4
"Chris Lovett" <chris@!nospam!.net> wrote in message news:<10*************@corp.supernews.com>...
In there user samples on www.gotdotnet.com you will find an XmlCsvReader
which may be of some help to you for step (1).

Converting the DataSet back to XML is easy, then from XML back to CSV can be
done with an XSL transform, which I think is included in teh XmlCsvReader
download.

So yes, this approach makes sense. A lot of folks are standardizing on XML
for this kind of processing. Hopefully eventually, you'll be able to
convince your business partner to just send you XML at some point in the
future, and then you're processing will get a bit more streamlined.

Chris, thanks for the response. I am currently looking at the
XmlCsvReader - it definitely looks like something that I could use.
Thanks for your hard work and pointing me in this direction.

Can it be modified? (it does appear to be copywritten)...

Is there a way to use an .XSD file to describe/interpret the column
tags instead of using the first line of the file to define the column
names (tags)? This would allow me to fully describe any of the input
files, using separate schemas, without needing to modify them before
the initial XML conversion. The added bonus would be to use the .XSD
files to validate the structure, datatype, cardinality, etc. - could
the XmlCsvReader descend from XmlValidatingReader?

Also, I came across a really good MSDN link article on customizing the
XmlReader:

http://msdn.microsoft.com/webservice...ustxmlread.asp

You are correct about the furture of our B2B. This is just the first
step before we "potentially" begin requesting each of our data vendors
to supply well-formed XML input streams (preferably via a web
service). But, we needed to get this part done reasonably quickly.

Thanks again,
Glenn
Nov 12 '05 #5
The eula is very open. Feel free to use it in your product and make
whatever changes necessary.

You could read the XSD and then pass in the column names:

XmlCsvReader reader = new XmlCsvReader(uri, nameTable);
reader.ColumnNames = new string[] { "foo", "bar", "etc" };
....

The problem is in .NET v1.1 you can't wrap this reader to the
XmlValidatingReader. But you could write out the XML, then read it using
XmlTextReader, and then the XmlValidatingReader can work over that.

"Glenn Owens" <go****@nixonpeabody.com> wrote in message
news:bc**************************@posting.google.c om...
"Chris Lovett" <chris@!nospam!.net> wrote in message news:<10*************@corp.supernews.com>...
In there user samples on www.gotdotnet.com you will find an XmlCsvReader
which may be of some help to you for step (1).

Converting the DataSet back to XML is easy, then from XML back to CSV can be done with an XSL transform, which I think is included in teh XmlCsvReader download.

So yes, this approach makes sense. A lot of folks are standardizing on XML for this kind of processing. Hopefully eventually, you'll be able to
convince your business partner to just send you XML at some point in the
future, and then you're processing will get a bit more streamlined.

Chris, thanks for the response. I am currently looking at the
XmlCsvReader - it definitely looks like something that I could use.
Thanks for your hard work and pointing me in this direction.

Can it be modified? (it does appear to be copywritten)...

Is there a way to use an .XSD file to describe/interpret the column
tags instead of using the first line of the file to define the column
names (tags)? This would allow me to fully describe any of the input
files, using separate schemas, without needing to modify them before
the initial XML conversion. The added bonus would be to use the .XSD
files to validate the structure, datatype, cardinality, etc. - could
the XmlCsvReader descend from XmlValidatingReader?

Also, I came across a really good MSDN link article on customizing the
XmlReader:

http://msdn.microsoft.com/webservice...ustxmlread.asp
You are correct about the furture of our B2B. This is just the first
step before we "potentially" begin requesting each of our data vendors
to supply well-formed XML input streams (preferably via a web
service). But, we needed to get this part done reasonably quickly.

Thanks again,
Glenn

Nov 12 '05 #6
The eula is very open. Feel free to use it in your product and make
whatever changes necessary.

You could read the XSD and then pass in the column names:

XmlCsvReader reader = new XmlCsvReader(uri, nameTable);
reader.ColumnNames = new string[] { "foo", "bar", "etc" };
....

The problem is in .NET v1.1 you can't wrap this reader to the
XmlValidatingReader. But you could write out the XML, then read it using
XmlTextReader, and then the XmlValidatingReader can work over that.

"Glenn Owens" <go****@nixonpeabody.com> wrote in message
news:bc**************************@posting.google.c om...
"Chris Lovett" <chris@!nospam!.net> wrote in message news:<10*************@corp.supernews.com>...
In there user samples on www.gotdotnet.com you will find an XmlCsvReader
which may be of some help to you for step (1).

Converting the DataSet back to XML is easy, then from XML back to CSV can be done with an XSL transform, which I think is included in teh XmlCsvReader download.

So yes, this approach makes sense. A lot of folks are standardizing on XML for this kind of processing. Hopefully eventually, you'll be able to
convince your business partner to just send you XML at some point in the
future, and then you're processing will get a bit more streamlined.

Chris, thanks for the response. I am currently looking at the
XmlCsvReader - it definitely looks like something that I could use.
Thanks for your hard work and pointing me in this direction.

Can it be modified? (it does appear to be copywritten)...

Is there a way to use an .XSD file to describe/interpret the column
tags instead of using the first line of the file to define the column
names (tags)? This would allow me to fully describe any of the input
files, using separate schemas, without needing to modify them before
the initial XML conversion. The added bonus would be to use the .XSD
files to validate the structure, datatype, cardinality, etc. - could
the XmlCsvReader descend from XmlValidatingReader?

Also, I came across a really good MSDN link article on customizing the
XmlReader:

http://msdn.microsoft.com/webservice...ustxmlread.asp
You are correct about the furture of our B2B. This is just the first
step before we "potentially" begin requesting each of our data vendors
to supply well-formed XML input streams (preferably via a web
service). But, we needed to get this part done reasonably quickly.

Thanks again,
Glenn

Nov 12 '05 #7

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

Similar topics

13
by: raykyoto | last post by:
Hi all, I'm sure this is a popular question that comes up every few months here. Indeed, I've looked at some of the past postings, but I would like to ask things differently. Basically, I'm...
0
by: Glenn Owens | last post by:
OK I'm on a steep learning curve with XML et.al. and need some advice. I'm writing a B2B front door for a new application. I have multiple data suppliers all sending various formats of flat...
22
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
2
by: mawi | last post by:
Hi there, When removing page children controls created dynamically not in last-to-first order, the close button of the last control looses its event wiring, even though the handler is rewired...
4
by: Ben | last post by:
So, at my place of employment, we use a national standard to transmit data between certain applications. This standard consists of a fixed width, flat file 4500-some-odd chars wide that contain...
7
by: Ryan Liu | last post by:
Hi, I want to backup database to a text file. There are binary columns. I read byte from the column and use ASCII encoding convert it to string and write to a text file. But there are bytes...
9
by: FFMG | last post by:
In my site I have a config table, (MySQL), with about 30 entries; the data is loaded on every single page load. This is not the only call to the db, (we do a total of about 8 calls to the db). As...
2
by: murthydb2 | last post by:
Hi My requirement is that i have to write a stored procedure in db2 and that will be executed in a batch file . Any system error or validation error that occurs inside the db2 sp during...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.