1.   DataSet ds = new DataSet();
  2.             ds.ReadXml(@"D:\foo.xml");
  3.             DataTable tbl =ds.Tables["cj"];
  4.            
  5.             tbl.PrimaryKey = new DataColumn[] { tbl.Columns["a"] };
  6.             DataView view = tbl.DefaultView;
  7.            
  8.             view.Sort = "a ASC";
  9.  
  10.             DataTable sortedBy_a = view.ToTable();
  11.  
  12.             //remove all the CJ tables -- they're currently unsorted
  13.             ds.Tables.Remove("cj");
  14.  
  15.             //add in all the sorted CJ tables
  16.             ds.Tables.Add(sortedBy_a);
  17.  
  18.             StringWriter sw = new StringWriter();
  19.            
  20.            ds.WriteXml(sw);
  21.            Console.WriteLine(sw.ToString());
  22.            Console.ReadLine();