CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2000
    Posts
    4

    Converting CSV to XML File Format

    Hello All,

    I have a question about converting a CSV file to XML format how do I do this,

    Thanks for any suggestions.




  2. #2
    Guest

    Re: Converting CSV to XML File Format

    There is a MSXml component in VB6.


  3. #3
    Join Date
    May 1999
    Posts
    3,332

    Re: Converting CSV to XML File Format


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: Converting CSV to XML File Format

    if you are familiar with the sed utility (a UNIX tool that's also available for Win32 from www.gnu.org), you can write a converter in a few lines:

    1i\
    <?xml version="1.0"?>
    1i\
    <rows>
    i\
    <row>
    s/\(.*\)/\1;/
    s@\([^;]+\);@<column>\1</column>@gp
    i\
    </row>
    $a\
    </rows>




    call this from a DOS commandline (or from vB via shell) like this:
    sed -nf yourscriptfile yourinputfile>outputfile.xml

    it creates a <row> tag for each row in the CSV file and a <col> tag for each column and all the required tags, so that you can view the result in IE 5.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured