请教Xml文件to DataSet
以下XML文件如何读入DataSet,请教一下:
<?xml version="1.0" encoding="gb2312"?>
<doc>
<table name="User_info" pk="ID">>
<Main>
<record>
<ID><![CDATA[001]]></ID>
<name><![CDATA[张三]]></name>
<sex><![CDATA[男]]></sex>
</record>
<record>
<ID><![CDATA[002]]></ID>
<name><![CDATA[李四]]></name>
<sex><![CDATA[男]]></sex>
</record>
</Main>
<table1>
<record>
<ID><![CDATA[001]]></ID>
<field1><![CDATA[c1]]></field1>
<field2><![CDATA[d2]]></field2>
</record>
<record>
<ID><![CDATA[002]]></ID>
<field1><![CDATA[c1]]></field1>
<field2><![CDATA[d2]]></field2>
</record>
</table1>
<table2>
<record>
<ID><![CDATA[001]]></ID>
<field3><![CDATA[e1]]></field3>
<field4><![CDATA[f2]]></field4>
</record>
</table2>
</table>
</doc>
好象无法用dataset.readXml读入,请教一下如何能读入到DataSet?
------解决方案--------------------
遍历XML取值
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath(""));
XmlNodeList nodes = doc.GetElementsByTagName("record");
foreach (XmlNode node in nodes)
{}
------解决方案--------------------
DataSet.ReadXML("")