如何获取 XmlNode 标记中参数的值。例如:

<weather time-layout="k-p24h-n7-1">
    <name>Weather Type, Coverage, and Intensity</name>
    <weather-conditions weather-summary="Mostly Sunny"/>
</weather>

我想获取节点“天气条件”中参数“天气摘要”的值。

最佳答案

var node = xmldoc.SelectSingleNode("weather/weather-conditions");
var attr = node.Attributes["weather-summary"];

关于c# - 如何从 C# 中的 XmlNode 获取参数值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2512923/

10-12 21:51