c# 读取xml 某个节点值
2021-04-10 10:27
标签:round microsoft span ice ros XML load name enc 想要获取的内容是:Area="河北" 下某节点值,应该怎么读取 XmlDocument doc = new XmlDocument(); if(node!=null) { string basePrice = node.SelectSingleNode("FreYkg").InnerText; string price = node.SelectSingleNode("FreYkgPrice").InnerText; } c# 读取xml 某个节点值 标签:round microsoft span ice ros XML load name enc 原文地址:https://www.cnblogs.com/xiaxiaomo/p/9044730.html一、xml格式如下:
string path = Server.MapPath("../Xml/EMS.xml");
doc.Load(path);
XmlNode node = doc.SelectSingleNode("Freight/freight[@Area=‘河北‘]|Freight/freight[@ExpreName=‘圆通‘]");/*查询的条件Area=‘河北‘ 或者 ExpreName=‘圆通‘*/