Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

convert CSV file to XML file format based on XSD file using SSIS (SQL Server 2008R2) Expand / Collapse
Author
Message
Posted Tuesday, August 2, 2011 12:17 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, January 19, 2016 8:48 PM
Points: 56, Visits: 311
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
Post #1152872
Posted Tuesday, August 2, 2011 1:20 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:36 PM
Points: 7,694, Visits: 13,834
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
Post #1152958
Posted Tuesday, August 2, 2011 2:35 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, January 19, 2016 8:48 PM
Points: 56, Visits: 311
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 ?
Post #1153060
Posted Tuesday, August 2, 2011 4:03 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:36 PM
Points: 7,694, Visits: 13,834
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


  Post Attachments 
ssis_xslt.jpg (241 views, 49.43 KB)
Post #1153172
Posted Wednesday, August 3, 2011 8:29 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, January 19, 2016 8:48 PM
Points: 56, Visits: 311
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
Post #1153583
Posted Tuesday, November 19, 2013 12:35 PM


UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Today @ 8:00 PM
Points: 1,470, Visits: 5,287
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 spitter? Try PatternSplitCM
Need to remove of 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

My blog
Post #1515732
Posted Tuesday, November 19, 2013 3:05 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 8:36 PM
Points: 39,672, Visits: 36,812
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Favorite Quotes:
"Has anyone ever told you that a query you have written runs too fast?" - Dwain Camps - 6 Mar 2014

Helpful Links:
How to post code problems
How to post performance problems
Post #1515808
Posted Thursday, October 22, 2015 12:26 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, November 13, 2015 1:16 AM
Points: 39, Visits: 117
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
Post #1729905
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse