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:
DataSetwithDataTablesthat mimic each type of heterogenous records. ORDataTablethat accommodates all of the heterogenous data.Parse the records and and distribute them in the the appropriate
DataTablesin yourDataSetSerialize the
DataSetusing code similar to the code below.Then, you can easily load the data directly into a
DataSetif you need to manipulate it.Here is a link to the MSDN documentation for XML Serialization.