/// <summary>
 /// LoadApprovedFile reads the Parsnip approval file into a memory structure for easy lookup. We're assuming that the
 /// content of this file is well formed and valid. Semantic errors will be silently ignored. Only samples with
 /// approved units will be added to the lookup table.
 /// </summary>
 void LoadApprovedFile(string pathName) {
     WriteMessage(MessageLevel.Info, string.Format("Loading Parsnip 'Approved' file: {0}", pathName));
     sampleInfoTable = new Dictionary<string, SampleInfo>();
     using (XmlReader reader = XmlReader.Create(pathName)) {
         SampleInfo si = null;
         string sample_name = null;
         while (reader.Read()) {
             switch (reader.NodeType) {
                 case XmlNodeType.Element:
                     if (reader.Name == "Sample") {
                         sample_name = reader.GetAttribute("name");
                         if (!string.IsNullOrEmpty(sample_name))
                             si = new SampleInfo(sample_name);
                     }
                     else if (si != null && reader.Name == "Unit") {
                         if (reader.GetAttribute("include") == "true")
                             si.AddApprovedUnit(reader.GetAttribute("name"));
                     }
                     break;
                 case XmlNodeType.EndElement:
                     if (reader.Name == "Sample") {
                         if (si != null) {
                             try {
                                 if (si.ApprovedUnitsCount > 0)
                                     sampleInfoTable.Add(si.Name, si);
                             }
                             catch (Exception x) {
                                 WriteMessage(MessageLevel.Warn, string.Format("Sample {0} cannot be loaded {1}", si.Name, x.Message));
                             }
                         }
                         si = null;
                     }
                     break;
                 default:
                     break;
             }
         }
     }
 }