<ReadRFID>
<Node name="add">
<name>大 门</name>
<xu>123456AB</xu>
<lianjie>有线连接</lianjie>
<ip>192.168.2.82</ip>
<mask>255.255.255.224</mask>
<way>192.168.2.94</way>
</Node>
<Node name="add">
<name>中美</name>
<xu>aa</xu>
<lianjie>有线连接</lianjie>
<ip>192.168.2.88</ip>
<mask>255.255.255.224</mask>
<way>192.168.2.94</way>
</Node>
</ReadRFID>我怎么读取第一个node里面的ip值呢。我没分了,谢谢
private XmlDocument XMLResponse = new XmlDocument(); XMLResponse.LoadXml(xml); XMLResponse.GetElementsByTagName("Node")[0].ChildNodes[3].InnerText;
XPath Query
就这两个啊。怎么写哟,能不能仔细点点呢。没分了帮帮忙嘛
using System.Xml.Linq;
using System.Xml.XPath;
XElement.Load(XmlFile).XPathSelectElement("/Node/ip").Value
XPath
root.SelectSingNode("//Node/ip").InnerText