Last post Jun 22, 2012 09:29 PM by Decker Dong - MSFT
Jun 20, 2012 02:48 PM|raghu1|LINK
I need to write a console application to build a data-feed for an external application. Data comes from sourceA and for some reason, the source does not want to send the data to the external entity. My role now is to get data from A, format it to B's specs
and send it across.
Now there are some codes that need to be translated. EG:
status: F,P,D, I, V : where F=full time , P=part time, D=Per Diem, I= Intern, V=volunteer
Ethenic Codes : 1-5 and each number has a value.
I need to put the description instead of the code in the feed.
I am thinking of building an XML with all such translation codes and read this XML to expand the codes to desciptions. In case a new value for say ethenic code or status comes, I will simply edit the XML(textpad or notepad) and the pain of hard coding another
value and re-compiling is done. this is easy to maintain.
I need pointers on the structure of my XML, I have not coded something like this. I do not want a bunch of XML and read each one for every value. There are 10 such descriptions so far and I do not want 1 XML for each such code: 1 for status, 1 for ethenicCode
etc. I am looking to have 1 XML with all the classification codes.
Thanks in advance,
Jun 21, 2012 08:20 PM|Decker Dong - MSFT|LINK
I strongly suggest you trying to use DataTable.WriteXml to output the xml file if you want to keep the file into the hard disc……；and anyway，you can design your DataTable by calling its Columns.Add……or Rows.Add……to dynamically add columns or rows and values，and
then send the DataTable，which is easy to control with……
Jun 22, 2012 09:51 AM|raghu1|LINK
There will be only reads and no writes. The data is pretty much static. There could be sporadic edits like a new code in 1 month or so. I can physically edit the XML. I did not want to have a DB with an almost hard coded table. At the most there are a 1000
elements. If DB, the table will have 3 columns and 1000 rows.
TranslationType, code, description.
Sample data in the column order:
Location, 1, newark
location, 2, jersey city
location, 3, new brunswick
location, 4, satellite:beach
gender, M , Male
gender, F, Female
club, Asian, Asian american club
club, History, National historic club
club, Atheletic-1, Rowing club (Men) inc 1997
I want to organize the above data in XML so that a new data comes in, the operators can add to the XML using notepad.
Jun 22, 2012 09:29 PM|Decker Dong - MSFT|LINK
So you can use DataTable to generate xml file，and here comes the example——
DataTable dt = new DataTable();