我有一個XML:如何讀取特定名稱的所有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)); –