日期:2014-05-18 浏览次数:21155 次
<?xml version="1.0" encoding="UTF-8"?> <protocal> <name>P1PPP</name> <version>1</version> <functions> <function name="readRTData"> <funcID>1</funcID> <start>1</start> <end>20</end> </function> <function name="readVerifyData"> <funcID>2</funcID> <start>21</start> <end>40</end> </function> <function name="writeCtrlData"> <funcID>3</funcID> <start>41</start> <end>60</end> </function> </functions> <registers> <register name="uvol_fr "> <addr>0</addr> <type>0</type> <property>1</property> </register> <register name="uvol_total_p"> <addr>2</addr> <type>0</type> <property>1</property> </register> </registers> </protocal>
XmlNode xmllist = XMLHelper.GetXmlNodeByXpath(filename, "/protocal/functions"); foreach (XmlNode n in xmllist.ChildNodes) { Debug.WriteLine(n.Attributes["name"]); foreach (XmlNode x in n.ChildNodes) Debug.WriteLine(x.Name + " " + x.InnerText); }