Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Converting CSV to XML?

Author  Topic 

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-09-04 : 19:30:46
Hi all,

I have a VBA app that imports CSV files. It is quite code intensive because of all the rules etc and the manipulations required. I was considering trying an XSLT option to make it more maintainable. But I'm having troubles finding any decent code samples in VB that will load a CSV file and convert it using an XSL template. There are loads in .NET, but this system is based in Access and I don't want to depend on the .NET framework just for this.
Has anyone had experience with this?

Cheers,

Tim

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-09-07 : 15:59:51
You're really asking two questions,
1. How do you convert CSV to XML using XSLT
2. Assuming you can do 1. how do you run the transformation in VBA

1. Take a look here http://blogs.msdn.com/kaevans/archive/2003/04/17/5780.aspx

2. You need to use the Microsoft Core XML Services (MSXML), available here
http://www.microsoft.com/downloads/details.aspx?familyid=993c0bcf-3bcf-4009-be21-27e85e1857b1&displaylang=en
There is lots of info about using MSXML from VBA on msdn.microsoft.com, but for a specific example of performing a transformation look here
http://msdn.microsoft.com/library/en-us/xmlsdk/html/ece045e3-85b3-46ed-85b4-8532f076ea79.asp
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-09-07 : 17:45:10
Excellent!

Thanks for the answer

Cheers,

Tim
Go to Top of Page
   

- Advertisement -