public virtual List <ETable> ParseFile(String path) { List <ETable> tableList = new List <ETable>(); XmlDoc doc = new XmlDoc(path); for (int i = 0; i < XmlDoc.AllNodes.Count; i++) { XmlNode ele = XmlDoc.AllNodes[i]; ETable table = new ETable(); String tagName = ele.Name; if (tagName.Contains("::")) { table.SetTableName(Regex.Split(tagName, "::")[1]); } else { table.SetTableName(tagName); } table.SetDate(ele.Attribute.Content); //需判断Content是否为空 if (ele.Content != "") { ParseTableData(table, ele.Content); tableList.Add(table); } } return(tableList); }
public static void Main(String[] args) { try { DefaultEfileParse parse = new DefaultEfileParse(); String file = "E:\\6.½Î÷ÏîÄ¿\\elanguage\\data\\ºá±íʽ.txt"; List <ETable> list = parse.ParseFile(file); elanguage.Util.Debug.Debugwrite(list); ETable et = new ETable(); et.SetColumnNames(new string[] { "˳Ðò", "×Ö¶Î1", "×Ö¶Î2", "×Ö¶Î3" }); object[] o1 = new object[] { "1", "111", "333", "222" }; object[] o2 = new object[] { "2", "411", "343", "222" }; object[] o3 = new object[] { "3", "141", "333", "242" }; List <object[]> listo = new List <object[]>(); listo.Add(o1); listo.Add(o2); listo.Add(o3); et.SetDatas(listo); et.SetTableName("Õï¶Ï½á¹û"); et.SetDate(DateTime.Now.ToString()); parse.CreateEFile(et, "@", "D:\\test.txt"); } catch (Exception e) { Console.Error.WriteLine(e.StackTrace); } }