title: want to import data from XML to SQLite database
body: <p>I have generated (export) an XML from my SQLite database in c#. Now, I need to import those data from the XML to an empty sqlite database.I also need to verify the contents while inserting the data into table. My generated xml from the database is -</p>
  
  <pre><code>&lt;root&gt;
      &lt;name1&gt;
          &lt;names&gt;
             &lt;id&gt;5&lt;/id&gt;
             &lt;class&gt;space&lt;/class&gt;
             &lt;from&gt;Germany&lt;/from&gt;
             &lt;to&gt;France&lt;/to&gt;
             &lt;through&gt;
                &lt;via&gt;
                     &lt;id&gt;7&lt;/id&gt;
                     &lt;route&gt;Vienna&lt;route&gt;
                 &lt;/via&gt;
             &lt;/through&gt;           
          &lt;/names&gt;
          &lt;mynames3&gt;Black&lt;/mynames3&gt;
          &lt;mynames4&gt;Hawkins&lt;/mynames4&gt;
      &lt;/name1&gt;
      &lt;name2&gt;
        &lt;newNames&gt;
            &lt;id&gt;8&lt;/id&gt;
            &lt;path&gt;Road&lt;/path&gt;
            &lt;dest&gt;USA&lt;/dest&gt;
            &lt;through&gt;
                &lt;route1&gt;
                    &lt;id&gt;5&lt;/id&gt;
                    &lt;naviagte&gt;Britain&lt;/naviagte&gt;
                    &lt;naviagte2&gt;Holland&lt;/naviagte2&gt;
                    &lt;naviagting2&gt;
                        &lt;naviagtes2&gt;
                              &lt;naviagte5&gt;France&lt;/naviagte5&gt;
                              &lt;naviagte6&gt;US&lt;/naviagte6&gt;
                              &lt;naviagte7&gt;Canada&lt;/naviagte7&gt;
                         &lt;naviagtes2&gt;
                    &lt;/naviagting2&gt;
                    &lt;naviagte11&gt;Russia&lt;/naviagte11&gt;
                    &lt;naviagte12&gt;Poland&lt;/naviagte12&gt;
                &lt;/route1&gt;
                &lt;route1&gt;
                    &lt;id&gt;2&lt;/id&gt;
                    &lt;naviagte&gt;Canada&lt;/naviagte&gt;
                &lt;/route1&gt;
            &lt;/through&gt;              
        &lt;/newNames&gt;
      &lt;/name2&gt;
      &lt;name3&gt;H2V3&lt;/name3&gt;
      &lt;name4&gt;H5V8&lt;/name4&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Could you give me any suggestion how to do so ? I am trying the following approach. </p>
  
  <pre><code>SqliteConnection sqlCon = new SqliteConnection("Data Source=" + dataPath + "/Empty.db3");
              sqlCon.Open();
              SqliteCommand sqlCmd = new SqliteCommand(sqlCon);
  
              DataSet ds = new DataSet();
              ds.ReadXml(Path.Combine(syncPath, tableName + "_4.xml"), XmlReadMode.ReadSchema);
              foreach(DataTable dt in ds.Tables)
              {
                  //Get field names
                  string sqlString = "INSERT into " + tableName + " (";
                  string valString = "";
                  var sqlParams = new string[dt.Rows[0].ItemArray.Count()];
                  int count = 0;
                  foreach(DataColumn dc in dt.Columns)
                  {
                      sqlString += dc.ColumnName + ", ";
                      valString += "@" + dc.ColumnName + ", ";
                      sqlParams[count] = "@" + dc.ColumnName;
                      count++;
                  }
                  valString = valString.Substring(0, valString.Length - 2);
                  sqlString = sqlString.Substring(0, sqlString.Length - 2) + ") VALUES (" + valString + ")";
  
                  sqlCmd.CommandText = sqlString;
                  foreach(DataRow dr in dt.Rows)
                  {
                      for (int i = 0; i &lt; dr.ItemArray.Count(); i++) 
                      {
                          sqlCmd.Parameters.AddWithValue(sqlParams[i], dr.ItemArray[i] ?? DBNull.Value);
                      }
  
                      sqlCmd.ExecuteNonQuery();
                  }
              }  
  </code></pre>
  
  <p>I need to verify the contents before inserting the data into an empty SQLite database. Could you please tell me which approach i should pursue ? </p>