日期:2014-05-17  浏览次数:20592 次

dataSet读取xml后是怎样的存储形态呢?
不是说dataSet是存储表结构的吗,xml的树形结点结构读取到dataSet中之后会是怎么样的呢

------解决方案--------------------
读取xml到dataset中,同样是表结构
------解决方案--------------------
C# code
     /// <summary>
        /// 获取XML数据库中的数据的方法
        /// </summary>
        /// <param name="strFilePath">传入文件路径</param>
        /// <returns>返回一个数据集</returns>
        public static DataSet GetAllDataFromXML(string strFilePath)
        {
            DataSet ds = new DataSet();
            FileInfo fileInfo = new FileInfo(strFilePath);
            if (fileInfo.Exists)
            {
                try
                {
                    ds.ReadXml(strFilePath);
                }
                catch { }
            }
            else
            {
                ds = null;
            }
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count < 1)
                    ds = null;
            }
            return ds;
        }

------解决方案--------------------
楼主是想问复杂xml如何读取吧