title: Create different xml files for each database row
body: <p>i have a project where i should generate different xml files for each row of a database. I have created the classes for the xml but i am not clear of how can i fill them. here are the classes:</p>
  <pre><code>     Xml2CSharp.GTalkMessage gTalkMessage = new Xml2CSharp.GTalkMessage
          {
              EnvelopeVersion = &quot;2.0&quot;,
              Header = &quot;&quot;,
              GovTalkDetails = &quot;&quot;,
              Body = &quot;&quot;,
              Xmlns = &quot;&quot;,
          };
          Xml2CSharp.Body body = new Xml2CSharp.Body
          {
              MessageRequest = &quot;&quot;,
          };
          Xml2CSharp.MessageRequest messageRequest = new Xml2CSharp.MessageRequest
          {
              OecdMessage = &quot;&quot;,
              FinancialInstitutionName = &quot;&quot;,
              NUIS = &quot;&quot;,
              SendDateTime = &quot;&quot;,
              Xmlns = &quot;&quot;,
          };
          Xml2CSharp.OecdMessage oecdMessage = new Xml2CSharp.OecdMessage
          {
              MessageSpec = &quot;&quot;,
              CrsBody = &quot;&quot;,
              Crs = &quot;&quot;,
              Cfc = &quot;&quot;,
              Stf = &quot;&quot;,
              Ftc = &quot;&quot;,
          };
          Xml2CSharp.CrsBody crsBody = new Xml2CSharp.CrsBody
          {
              ReportingFI = &quot;&quot;,
              ReportingGroup = &quot;&quot;,
          };
          Xml2CSharp.ReportingGroup reportingGroup = new Xml2CSharp.ReportingGroup
          {
              AccountReport = &quot;&quot;,
          };
          Xml2CSharp.AccountReport accountReport = new Xml2CSharp.AccountReport
          {
              DocSpec = &quot;&quot;,
              AccountNumber = &quot;&quot;,
              AccountHolder = &quot;&quot;,
              AccountBalance = &quot;&quot;,
          };
          Xml2CSharp.AccountBalance accountBalance = new Xml2CSharp.AccountBalance
          {
              CurrCode = &quot;&quot;,
              Text = &quot;&quot;,
          };
          Xml2CSharp.AccountHolder accountHolder = new Xml2CSharp.AccountHolder
          {
              Individual = &quot;&quot;,
          };
          Xml2CSharp.Individual individual = new Xml2CSharp.Individual
          {
              ResCountryCode = &quot;&quot;,
              TIN = &quot;&quot;,
              Name = &quot;&quot;,
              Address = &quot;&quot;,
              BirthInfo = &quot;&quot;,
          };
          Xml2CSharp.BirthInfo birthInfo = new Xml2CSharp.BirthInfo
          {
              BirthDate = &quot;&quot;,
              CountryInfo = &quot;&quot;,
          };
          Xml2CSharp.CountryInfo countryInfo = new Xml2CSharp.CountryInfo
          {
              CountryCode = &quot;&quot;,
  
          };
          Xml2CSharp.Name name = new Xml2CSharp.Name
          {
              FirstName = &quot;&quot;,
              LastName = &quot;&quot;,
          };
          Xml2CSharp.TIN TIN = new Xml2CSharp.TIN
          {
              IssuedBy = &quot;&quot;,
              Text = &quot;&quot;,
          };
          Xml2CSharp.AccountNumber AccountNumber = new Xml2CSharp.AccountNumber
          {
              AcctNumberType = &quot;&quot;,
              UndocumentedAccount = &quot;&quot;,
              ClosedAccount = &quot;&quot;,
              DormantAccount = &quot;&quot;,
          };
          Xml2CSharp.ReportingFI ReportingFI = new Xml2CSharp.ReportingFI
          {
              ResCountryCode = &quot;&quot;,
              IN = &quot;&quot;,
              Name = &quot;&quot;,
              Address = &quot;&quot;,
              DocSpec = &quot;&quot;,
          };
          Xml2CSharp.DocSpec DocSpec = new Xml2CSharp.DocSpec
          {
              DocTypeIndic = &quot;&quot;,
              DocRefId = &quot;&quot;,
          };
          Xml2CSharp.Address Address = new Xml2CSharp.Address
          {
              CountryCode = &quot;&quot;,
              AddressFix = &quot;&quot;,
          };
          Xml2CSharp.AddressFix AddressFix = new Xml2CSharp.AddressFix
          {
              Street = &quot;&quot;,
              PostCode = &quot;&quot;,
              City = &quot;&quot;,
          };
          Xml2CSharp.IN IN = new Xml2CSharp.IN
          {
              IssuedBy = &quot;&quot;,
              Text = &quot;&quot;,
          };
          Xml2CSharp.MessageSpec MessageSpec = new Xml2CSharp.MessageSpec
          {
              SendingCompanyIN = &quot;&quot;,
              TransmittingCountry = &quot;&quot;,
              ReceivingCountry = &quot;&quot;,
              MessageType = &quot;&quot;,
              MessageRefId = &quot;&quot;,
              MessageTypeIndic = &quot;&quot;,
              ReportingPeriod = &quot;&quot;,
              Timestamp = &quot;&quot;,
          };
          Xml2CSharp.GTalkDetails GTalkDetails = new Xml2CSharp.GTalkDetails
          {
              Keys = &quot;&quot;,
          };
          Xml2CSharp.Keys Keys = new Xml2CSharp.Keys
          {
              Key = &quot;&quot;,
          };
          Xml2CSharp.Key Key = new Xml2CSharp.Key
          {
              Type = &quot;&quot;,
              Text = &quot;&quot;,
          };
          Xml2CSharp.Header Header = new Xml2CSharp.Header
          {
              MessageDetails = &quot;&quot;,
              SenderDetails = &quot;&quot;,
          };
          Xml2CSharp.SenderDetails SenderDetails = new Xml2CSharp.SenderDetails
          {
              IDAuthentication = &quot;&quot;,
          };
          Xml2CSharp.IDAuthentication IDAuthentication = new Xml2CSharp.IDAuthentication
          {
              SenderID = &quot;&quot;,
              Authentication = &quot;&quot;,
          };
          Xml2CSharp.Authentication Authentication = new Xml2CSharp.Authentication
          {
              Method = &quot;&quot;,
              Value = &quot;&quot;,
          };
          Xml2CSharp.MessageDetails MessageDetails = new Xml2CSharp.MessageDetails
          {
              Class = &quot;&quot;,
              Qualifier = &quot;&quot;,
              Function = &quot;&quot;
          };
  
          XmlSerializer serializer = new XmlSerializer(typeof(GTalkMessage));
          serializer.Serialize(File.Create(&quot;fileTest.xml&quot;), gTalkMessage);
  </code></pre>
  <p>here is the xml i need to generate:</p>
  <pre><code>&lt;GTalkMessage xmlns=&quot;http:/xxxxxxxxxxxx&quot;&gt;
    &lt;EnvelopeVersion&gt;2.0&lt;/EnvelopeVersion&gt;
    &lt;Header&gt;
      &lt;MessageDetails&gt;
        &lt;Class&gt;Dxxxxxxx&lt;/Class&gt;
        &lt;Qualifier&gt;request&lt;/Qualifier&gt;
        &lt;Function&gt;submit&lt;/Function&gt;
      &lt;/MessageDetails&gt;
      &lt;SenderDetails&gt;
        &lt;IDAuthentication&gt;
          &lt;SenderID&gt;tttttt1&lt;/SenderID&gt;
          &lt;Authentication&gt;
            &lt;Method&gt;clear&lt;/Method&gt;
            &lt;Value&gt;b@xxxxxxxxxxxx&lt;/Value&gt;
          &lt;/Authentication&gt;
        &lt;/IDAuthentication&gt;
      &lt;/SenderDetails&gt;
    &lt;/Header&gt;
    &lt;GovTalkDetails&gt;
      &lt;Keys&gt;
        &lt;Key Type=&quot;SpokeName&quot;&gt;mmmmmmm&lt;/Key&gt;
      &lt;/Keys&gt;
    &lt;/GovTalkDetails&gt;
    &lt;Body&gt;
      &lt;MessageRequest xmlns=&quot;http://xxxxxxxx&quot;&gt;
        &lt;OecdMessage xmlns:crs=&quot;urn: oecd:ties: crs:v1&quot;
                     xmlns:cfc=&quot;urn:oecd:ties:commontypesfatcacrs:v1&quot;
                     xmlns:stf=&quot;urn: oecd:ties: stf:v4&quot;
                     xmlns:ftc=&quot;urn: oecd:ties: fatca:v1&quot;&gt;
          &lt;crs:MessageSpec&gt;
            &lt;crs:SendingCompanyIN&gt;99999999&lt;/crs:SendingCompanyIN&gt;
            &lt;crs:TransmittingCountry&gt;ak&lt;/crs:TransmittingCountry&gt;
            &lt;crs:ReceivingCountry&gt;ak&lt;/crs:ReceivingCountry&gt;
            &lt;crs:MessageType&gt;CRS&lt;/crs:MessageType&gt;
            &lt;crs:MessageRefId&gt;0987654321&lt;/crs:MessageRefId&gt;
            &lt;crs:MessageTypeIndic&gt;CRS701&lt;/crs:MessageTypeIndic&gt;
            &lt;crs:ReportingPeriod&gt;2019-12-31&lt;/crs:ReportingPeriod&gt;
            &lt;crs:Timestamp&gt;2020-09-18T09:33:00&lt;/crs:Timestamp&gt;
          &lt;/crs:MessageSpec&gt;
          &lt;crs:CrsBody&gt;
            &lt;crs:ReportingFI&gt;
              &lt;crs:ResCountryCode&gt;AL&lt;/crs:ResCountryCode&gt;
              &lt;crs:IN issuedBy=&quot;ak&quot;&gt;999999&lt;/crs:IN&gt;
              &lt;crs:Name&gt;Eeeeee&lt;/crs:Name&gt;
              &lt;crs:Address&gt;
                &lt;cfc:CountryCode&gt;ak&lt;/cfc:CountryCode&gt;
                &lt;cfc:AddressFix&gt;
                  &lt;cfc:Street&gt;Rruga&lt;/cfc:Street&gt;
                  &lt;cfc:PostCode&gt;uuuu&lt;/cfc:PostCode&gt;
                  &lt;cfc:City&gt;aaaa«&lt;/cfc:City&gt;
                &lt;/cfc:AddressFix&gt;
              &lt;/crs:Address&gt;
              &lt;crs:DocSpec&gt;
                &lt;stf:DocTypeIndic&gt;aaaa&lt;/stf:DocTypeIndic&gt;
                &lt;stf:DocRefId&gt;0123456789&lt;/stf:DocRefId&gt;
              &lt;/crs:DocSpec&gt;
            &lt;/crs:ReportingFI&gt;
            &lt;crs:ReportingGroup&gt;
              &lt;crs:AccountReport&gt;
                &lt;crs:DocSpec&gt;
                  &lt;stf:DocTypeIndic&gt;OECD1&lt;/stf:DocTypeIndic&gt;
                  &lt;stf:DocRefId&gt;0123456789&lt;/stf:DocRefId&gt;
                &lt;/crs:DocSpec&gt;
                &lt;crs:AccountNumber AcctNumberType=&quot;pppppp&quot;
                      UndocumentedAccount=&quot;false&quot; ClosedAccount=&quot;false&quot;
                    DormantAccount=&quot;false&quot;&gt;0123456789&lt;/crs:AccountNumber&gt;
                &lt;crs:AccountHolder&gt;
                  &lt;crs:Individual&gt;
                    &lt;crs:ResCountryCode&gt;Ak&lt;/crs:ResCountryCode&gt;
                    &lt;crs:TIN issuedBy=&quot;Ak&quot;&gt;bbbbbbb&lt;/crs:TIN&gt;
                    &lt;crs:Name&gt;
                      &lt;crs:FirstName&gt;yyy&lt;/crs:FirstName&gt;
                      &lt;crs:LastName&gt;yyy&lt;/crs:LastName&gt;
                    &lt;/crs:Name&gt;
                    &lt;crs:Address&gt;
                      &lt;cfc:CountryCode&gt;Ak&lt;/cfc:CountryCode&gt;
                      &lt;cfc:AddressFix&gt;
                        &lt;cfc:PostCode&gt;uuu1&lt;/cfc:PostCode&gt;
                        &lt;cfc:City&gt;oooooo&lt;/cfc:City&gt;
                      &lt;/cfc:AddressFix&gt;
                    &lt;/crs:Address&gt;
                    &lt;crs:BirthInfo&gt;
                      &lt;crs:BirthDate&gt;1988-02-02&lt;/crs:BirthDate&gt;
                      &lt;crs:CountryInfo&gt;
                        &lt;crs:CountryCode&gt;AL&lt;/crs:CountryCode&gt;
                      &lt;/crs:CountryInfo&gt;
                    &lt;/crs:BirthInfo&gt;
                  &lt;/crs:Individual&gt;
                &lt;/crs:AccountHolder&gt;
                &lt;crs:AccountBalance currCode=&quot;EUR&quot;&gt;25000.00&lt;/crs:AccountBalance&gt;
              &lt;/crs:AccountReport&gt;
            &lt;/crs:ReportingGroup&gt;
          &lt;/crs:CrsBody&gt;
        &lt;/OecdMessage&gt;
        &lt;FinancialInstitutionName&gt;test&lt;/FinancialInstitutionName&gt;
        &lt;NUIS&gt;9999999&lt;/NUIS&gt;
        &lt;SendDateTime&gt;2020-08-31&lt;/SendDateTime&gt;
      &lt;/MessageRequest&gt;
    &lt;/Body&gt;
  &lt;/GTalkMessage&gt;
  </code></pre>
  <p>and here is how i was thinking to get the data from the database:</p>
  <pre><code>   DataTable dt = new DataTable();
          DataSet ds = new DataSet();
  
          dt = GetRecordDetails();    
  
          ds.Tables.Add(dt);
          ds.Tables[0].TableName = &quot;&quot;;
  </code></pre>
  <p>can you help me to assign the data to the tags they belong to?</p>