-
CSV to XML
Hi all,
I'm an XML develper with 2 whole days worth of experience! I need to convert
a CSV file dump from a customer, to XML for integration in our database.
This will happen everyday. So far I have found a littel app called doc2xml
which uses a template file and does the conversion (check out www.geocities.com/siliconvalley/platform/4871
).
This is a quick and dirty tool that does the job but is it will require user
interaction (I guess) to kick the job off. Is there a more elegant way of
doing this, possibly with XSL/XSLT ???? Can anyone point me in the right
direction?
Cheers,
Pete
-
Re: CSV to XML
You'll need to run code to transform a CSV file into an XML file--you can't
use XSLT because the CSV file isn't an XML file and won't parse. However,
it's relatively easy to write a custom program to perform the conversion,
and not too much more difficult to write a fairly generic version, depending
on how much you need to customize the XML. For example, you could write a VB
executable that accepts an input file and (optionally) a definition file and
outputs an XML file formatted according to the rules in the definition file.
On the other hand, you might consider attacking the problem from the
opposite direction. For example, all major databases can import data from
CSV files. After you have the data in a temporary table, some newer
databases will let you write queries that return XML. Alternately, you could
use ADO to query the imported temp table for the data and then save the
resulting Recordset with the adPersistXML option constant.
I've listed these options in reverse order of the control you'll have over
the resulting XML.
Good Luck,
Russell Jones
Sr. Web Development Editor
DevX.com
"Pete_G" <petergibbins@yahoo.co.uk> wrote in message
news:3a647f49$1@news.devx.com...
>
> Hi all,
> I'm an XML develper with 2 whole days worth of experience! I need to
convert
> a CSV file dump from a customer, to XML for integration in our database.
> This will happen everyday. So far I have found a littel app called doc2xml
> which uses a template file and does the conversion (check out
www.geocities.com/siliconvalley/platform/4871
> ).
>
> This is a quick and dirty tool that does the job but is it will require
user
> interaction (I guess) to kick the job off. Is there a more elegant way of
> doing this, possibly with XSL/XSLT ???? Can anyone point me in the right
> direction?
>
> Cheers,
>
> Pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks