c# - 如何使用 c#.net 读取 XML 中的 XML 节点

标签 c# asp.net xml

我有一个如下所示的 XML 文件:

<report timestamp="3201" reportVersion="2" request="3981135340">
<question timedOut="false" time="3163" attempts="2" correct="true" id="13"> 
<answer status="attempt"> 
<radioButton correct="false" value="true" id="17" /> 
</answer> 
<answer status="correct"> 
<radioButton correct="true" value="true" id="15" /> 
</answer> 
</question> 
</report>

我想根据“answer”节点的“status”属性读取子节点。

最佳答案

使用XmlReader (最快但仅向前),XDocument (LINQ to XML)或 XmlDocument .请参阅 msdn 文档中的示例。

关于c# - 如何使用 c#.net 读取 XML 中的 XML 节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2947738/

相关文章:

python - 如何在 python 中更新/修改 XML 文件?

c# - String.Replace 似乎没有替换 Hex char

c# - 创建模型时无法使用上下文异常

c# - 下载链接失效

c# - MultiView 和 GridView 分页问题

asp.net - Web 部署到 Azure 不会强制 Web App 接受新的更改

php - SimpleXMLElement 使用命名空间访问元素?

sql - SQL Server中的BCP导致错误

c# - 强制 JSON.NET 在序列化 DateTime 时包含毫秒(即使 ms 组件为零)

C# 字典在另一个字典中使用 TValue