读书人

readxml如何读取

发布时间: 2012-05-16 23:40:10 作者: rapoo

readxml怎么读取?
xml文件:

XML code
<?xml version="1.0" encoding="utf-8" ?> <mai xmlal="int">2</mai> 


如何用dataset.readxml读取那个mai的2。

[解决办法]
C# code
 string xmlFilename = "XmlDocument.xml";    // Use WriteXml to write the document.    OriginalDataSet.WriteXml(xmlFilename);    // Dispose of the original DataSet.    OriginalDataSet.Dispose();    // Create a new DataSet.    DataSet newDataSet = new DataSet("New DataSet");    // Read the XML document into the DataSet.    newDataSet.ReadXml(xmlFilename);
[解决办法]
顶楼上,msdn有例子
[解决办法]
XmlDocument xmlDoc=new XmlDocument();
xmlDoc.Load(@"路径");
用xmlDoc.DocumentElement.InnerXml得到。

读书人网 >asp.net

热点推荐