Parsing XML with SSIS transformation script

October 14, 2010 at 9:33 am | Posted in SSIS | Leave a comment
The ssis query component runs a query on the database and return the XML data in text
The transformation script will read the input row, parse the blob ito string and then parse the XML data embeded within the text

 Dim xml String As String= System.Text.Encoding.ASCII.GetString(Row.MESSAGE.GetBlobData(0, CInt(Row.MESSAGE.Length)))

Dim sr As New System.IO.StringReader(xmlString)

 Dim doc As New Xml.XmlDocument doc.Load(sr)
 
 
 Dim reader As New Xml.XmlNodeReader(doc)
  While reader.Read()  Output0Buffer.AddRow()
If reader.Name = “TagName” Then

 

  Try  
 
 Output0Buffer.PRECORDID = reader.GetAttribute(1)
….
 

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

Follow

Get every new post delivered to your Inbox.