【发布时间】:2012-11-08 00:37:28
【问题描述】:
我有一个 XML:
<?xml version="1.0" encoding="UTF-8"?>
<ticket>
<comments type="array">
<comment>
<attachments type="array">
<attachment>
<url>I NEED WHATEVER IS IN HERE</url>
</attachment>
</attachments>
</comment>
<comment>
<attachments type="array">
<attachment>
<url>I NEED WHATEVER IS IN HERE</url>
</attachment>
</attachments>
<comment>
</comments>
</ticket>
我将如何获取 URL 标记内的任何内容并将其添加到 <List>?我正在使用 C#。
【问题讨论】:
-
您接收 Xml 的格式是什么?文件、XDocument、XmlDocument 等?
-
var doc = new XmlDocument(); doc.LoadXml(client.DownloadString(url));