Hello-
I am constructing an XML import package intended to consume fairly typical (if a bit complex) XML. The import must:
- Loop through a configured location and serially load each XML file found.
- Parse certain values into columnar format and insert them to a "Load" table
- Insert the contents of the entire file in an XML-type field in the same table.
Currently, I can load the XML files via a Foreach file enumerator (works fine), and in a Data Flow inside the Foreach use an XML Source to load the XML into the flow as fields. Easy peasy, I've got my columnar data. However, this doesn't do much for me in terms of loading the entire file into a single field.
I have investigated means of doing this with the Import Column transformation, but those seem to be dead ends. I can define an additional Flat File source, and pull in a column containing the XML. But I can't see how to connect this new field into the rest of my dataset. I have no Join columns to connect to in the "XML string" dataset.
So I have arrived at the conclusion that I will need to add a Script Component to the data flow that accepts the full Path/Name of the file from an SSIS variable (already defined) and returns just the text value of the XML as a new Column. So I would be doing the XML-to-string manuever in that script.
Does anybody have any guidance here? Am I close with the Import Column tactic, or am I better off creating a Script?
Thanks,
Andy T.