public void Parse(XmlNode doc) { XmlNodeList roots = doc.SelectNodes("ConfigData"); if (roots.Count == 0) { throw new Exception("ExcelFile not found!"); } if (roots.Count > 1) { throw new Exception("ExcelFile Error!"); } XmlNode root = roots[0]; XmlAttribute xmlName = root.Attributes["Serverpath"]; if (xmlName == null) { throw new Exception("protocol no [Serverpath] atrribute!"); } ServerPath = xmlName.Value; xmlName = root.Attributes["ClientPath"]; if (xmlName == null) { throw new Exception("protocol no [ClientPath] atrribute!"); } ClientPath = xmlName.Value; xmlName = root.Attributes["Excelpath"]; if (xmlName == null) { throw new Exception("protocol no [Excelpath] atrribute!"); } Excelpath = xmlName.Value; //define XmlNodeList xmldefinesList = root.SelectNodes("ExcelFile"); for (int i = 0; i < xmldefinesList.Count; i++) { XmlNode xmldefines = xmldefinesList[i]; ExcelData excelData = new ExcelData(); excelData.Parse(xmldefines); excelDatalist.Add(excelData); } }