Skip to content

ravinem/Generic-Xml-Writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generic

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:

  1. Call ExtractFileService's class WriteRecord method.
  2. To remove empty nodes from returned xmls, for each xml call method removeEmptyNodes(xml)

About

Takes data table from database as input and based on specified XML format, creates XML.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages