I have a text file (generated from a COBOL legacy system) that has a varying record layout. It is analogous to this:
http://www.stylusstudio.com/varying_record_layout.html
What I want to do is parse that text file using C# a get an output in XML format and then load its content to a database. (In few words make ETL operation).
How can I accomplish this task using C# and handle an XML API? Some suggestions, tips, &c.?
You might try something like this:
DataSet
withDataTables
that mimic each type of heterogenous records. ORDataTable
that accommodates all of the heterogenous data.Parse the records and and distribute them in the the appropriate
DataTables
in yourDataSet
Serialize the
DataSet
using code similar to the code below.Then, you can easily load the data directly into a
DataSet
if you need to manipulate it.Here is a link to the MSDN documentation for XML Serialization.