标签:style blog color io os ar for sp div
private void Bind() { string strLogPath = ConfigurationSettings.AppSettings["LOG_PATH"].ToString(); if (strLogPath.Length > 0 && strLogPath[strLogPath.Length - 1] != ‘\\‘) strLogPath += ‘\\‘; string strXMLUrl = String.Format("{0}{1}.xml", strLogPath, DateTime.Now.ToString("yyyyMMdd")); string xmlContent = Common.Library.ReadFileAbsolute(strXMLUrl, ASCIIEncoding.GetEncoding("GB2312")).Replace("\r\n", ""); StringReader strReader = new StringReader(xmlContent); DataSet ds = new DataSet(); ds.ReadXml(strReader); DataTable dt = ds.Tables["item"]; }
ds.ReadXml(xmlContent);直接读取要报错 有非法字符
所以在read之前用流来读一次
StringReader strReader = new StringReader(xmlContent);
问题结局。原理自己google吧。
标签:style blog color io os ar for sp div
原文地址:http://www.cnblogs.com/huangyoum/p/4047709.html