We need to take the results of a SQL query and format them to a XML schema document (.xsd). I was wondering if anyone had any ideas as to how to perform this? This will be run primarily on MS SQL7/2000 although DB2, Sybase, Oracle, etc. are not out of the question so we need a database-independant solution.

I'm thinking the hardest part would be to figure out how to format the result set as defined per the XSD (the main part of the app anyway ).
We're using VB6 and MS XML 4 currently, although we're going to move to java so we can run it on *nix environments.

Any thoughts?