我的方法:循環通過XML文檔
if (File.Exists(@"C:\config.xml"))
{
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
xd.Load(@"C:\config.xml");
System.Xml.XmlElement root = xd.DocumentElement;
System.Xml.XmlNodeList nl = root.SelectNodes("/config");
foreach (System.Xml.XmlNode xnode in nl)
{
string name = xnode.Name;
string value = xnode.InnerText;
string nv = name + "|" + value;
Send(nv);
}
我的XML文檔
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config>
<bla>D</bla>
<def>300</def>
<ttOUT>34000</ttOUT>
<num>3800</num>
<pw>help</pw>
<err>1</err>
....and so on
</config>
現在我的方法返回第2,沒有別的。 我在做什麼錯?
你說它返回前兩個,你的意思是``和``? –
2011-01-21 09:33:27
您可能指向未保存的測試文件... – 2011-01-21 09:33:28