Takes data table as input and based on configuration creates XMLs and return list of all XMLs as string.
To Do before using:
- Configuration file (app or web) should have AppSetting key "FileMappingConfigs" and its value should be directory where configuration file are to be added.
- At 'FileMappingConfigs' folder create two Xml files .xml and _outputFormat.xml file. (processname is the second parameter of WriteRecord method.)
- Inside SampleConfig Files folder I have provided example for both config files.
- NewXMLForEachNewValue node in .xml : It is comma separated Db Column names based on which new XML will be created.
- DbColumnForSorting node in .xml : It is comma separated Db column names to sort the datatable.
- DbColumnsThatShouldCombineUnique node in .xml : It is comma separated Db Column names based on which XML layering is done. If there are repeating nodes on same level then we need two layering separated by #. Example 1 :
-- REAPEATING NODE
Cake
0.55
Regular -- REAPEATING NODE
Chocolate
Blueberry
None -- REAPEATING NODE
Glazed
Sugar
...
DbColumnsThatShouldCombineUnique would be "ItemId,BatterId#ItemId,ToppingId" (# because BatterId and ToppingId are on same level)Example 2:
-- REPEATING NODE
1
assd
-- REPEATING NODE
AlbumId
AlbumName
Genre
-- REPEATING NODE
SongId
SongName
DbColumnsThatShouldCombineUnique would be "ArtistId,AlbumId,SongId" (because each artist has unique album and each album has unique song)
-_outputFormat.xml : Should have format of XML that you want. Node/attribute Values are to map node name with Db Column name.
How to Use:
- Call ExtractFileService's class WriteRecord method.
- To remove empty nodes from returned xmls, for each xml call method removeEmptyNodes(xml)