CSV to XML


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: CSV to XML

  1. #1
    Pete_G Guest

    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

  2. #2
    Russell Jones Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center