SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


convert CSV file to XML file format based on XSD file using SSIS (SQL Server 2008R2)


convert CSV file to XML file format based on XSD file using SSIS (SQL Server 2008R2)

Author
Message
krish.sett
krish.sett
SSC Veteran
SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)

Group: General Forum Members
Points: 266 Visits: 319
Hi All,

In my current project we have requirement where i have to convert CSV file to XML file format based on XSD file using SSIS & T-sql .
Could you please let me know the best way of converting CSV to XML file format...

Thanks for your help

Regards
Krsihna
Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40510 Visits: 14413
Have you considered using XSLT to transform the file? If you already have an XSD then mapping the input columns to that should be trivial with a decent XML Development IDE. Check out XML Spy.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
krish.sett
krish.sett
SSC Veteran
SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)

Group: General Forum Members
Points: 266 Visits: 319
Thanks for your suggestion ,however our team is looking for something Open source.let me know if we have something like XML Spy which is open source.

I have the XSD file for my XML file ,Can we convert using some .net plug in ?
Orlando Colamatteo
Orlando Colamatteo
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40510 Visits: 14413
krish.sett (8/2/2011)
Thanks for your suggestion ,however our team is looking for something Open source.let me know if we have something like XML Spy which is open source.

I have the XSD file for my XML file ,Can we convert using some .net plug in ?

XML Spy is just a development tool. SSIS, which you said you were open to using, will do the actual conversion of your CSV file to an XML file using the XSLT file you designed in XML Spy and the XSD you were given. Have a look at the XML Task in SSIS. You would be looking at a config similar to this:



If XML Spy is too pricey search for "free xslt designer" or "open source xml ide" and see what turns up.

__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Attachments
ssis_xslt.jpg (434 views, 49.00 KB)
krish.sett
krish.sett
SSC Veteran
SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)SSC Veteran (266 reputation)

Group: General Forum Members
Points: 266 Visits: 319
Thanks for the info.....so basically i need to create a XSLT file for my XML file so that i can use XML Task Editor for the conversion.

This is really awesome...thanks for the suggestion and will work on creating XSLT file (Its new stuff to me) and will let you once i am done.

Once again thank u very much
Alan.B
Alan.B
SSChampion
SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)SSChampion (13K reputation)

Group: General Forum Members
Points: 13629 Visits: 8012
krish.sett (8/3/2011)
Thanks for the info.....so basically i need to create a XSLT file for my XML file so that i can use XML Task Editor for the conversion.

This is really awesome...thanks for the suggestion and will work on creating XSLT file (Its new stuff to me) and will let you once i am done.

Once again thank u very much


Writing XML Transforms (what you will hear XSLT files referred to) can be a little tricky. A really good site for getting the basics down is the W3Schools XSL tutorial and their XPath Tutorial.

-- Alan Burstein



Best practices for getting help on SQLServerCentral
Need to split a string? Try DelimitedSplit8K or DelimitedSplit8K_LEAD (SQL 2012+)
Need a pattern-based splitter? Try PatternSplitCM
Need to remove or replace those unwanted characters? Try PatExclude8K and PatReplace8K.

"I can't stress enough the importance of switching from a 'sequential files' mindset to 'set-based' thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code. " -- Itzek Ben-Gan 2001
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (218K reputation)SSC Guru (218K reputation)SSC Guru (218K reputation)SSC Guru (218K reputation)SSC Guru (218K reputation)SSC Guru (218K reputation)SSC Guru (218K reputation)SSC Guru (218K reputation)

Group: General Forum Members
Points: 218480 Visits: 41996
miraeg66 (11/13/2013)
thanks alot for the info


Heh... foreign language or not, I hate SPAM! Reported!

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
saxena200
saxena200
SSC Veteran
SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)SSC Veteran (234 reputation)

Group: General Forum Members
Points: 234 Visits: 168
Hey Krishna,

Were you able to achieve this? If yes
..
can you guide me how?

I believe XSLT is to transform XML from one format to another not generate from other file formats.

Thanks,
Arun
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search