怎么获取这样的XML节点
如何获取这样的XML节点
我需要获得最后一行节点里边的数据,我应该如何搞?试了很多方法都返回null,求各位大神帮忙
------解决思路----------------------
获得XXX么?
我有一个xml是这样的
我获取某个节点的value是使用了
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="xxxxx">
<property name="connection.connection_string">Server=Lost\Lost;initial catalog=db_DWS_Subway;Integrated Security=False;User Id=sa;Password=1234;MultipleActiveResultSets=True;Min Pool Size=20;Max Pool Size=60</property>
我需要获得最后一行节点里边的数据,我应该如何搞?试了很多方法都返回null,求各位大神帮忙
------解决思路----------------------
获得XXX么?
我有一个xml是这样的
<configuration>
<appSettings>
<add key="ServerIP" value="192.168.1.120" />
<add key="ListenPort" value="5555" />
<add key="MaxSize" value="1024" />
<add key="MaxCon" value="20" />
</appSettings>
</configuration>
我获取某个节点的value是使用了
XmlDocument doc = new XmlDocument();
doc.Load(Environment.CurrentDirectory + "/app.config");
XmlNodeList nodes = doc.GetElementsByTagName("add");
var ServerIP = nodes.Cast<XmlNode>().Where(d => d.Attributes["key"].Value == "ServerIP").First().Attributes["value"].Value;