//获取xml数据,并转换为dataset public static DataSet getConfig(string strXmlPath) { string filePath = GetPhysicalPath(); DataSet ds= ConvertXMLFileToDataSet(GetXmlFullPath(filePath)); return ds; } //将xml文件转换为DataSet public static DataSet ConvertXMLFileToDataSet(string xmlFile) { StringReader stream = null; XmlTextReader reader = null; try { XmlDocument xmld = new XmlDocument(); xmld.Load(xmlFile); DataSet xmlDS = new DataSet(); stream = new StringReader(xmld.InnerXml); //从stream装载到XmlTextReader reader = new XmlTextReader(stream); xmlDS.ReadXml(reader); //xmlDS.ReadXml(xmlFile); return xmlDS; } catch (System.Exception ex) { throw ex; } finally { if (reader != null) reader.Close(); } }
本文URL地址:http://www.bianceng.cn/Programming/csharp/201410/45572.htm
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索string
, dataset
, stream
, xmldocument
, reader
xmltextreader
c站、c语言、cf、ch、c罗,以便于您获取更多的相关知识。
时间: 2025-01-21 04:19:20