【发布时间】:2015-08-12 02:41:08
【问题描述】:
<channel>
<title>test + test</title>
<link>http://testprog.test.net/api/test</link>
<description>test.com</description>
<category>test + test</category>
<item xml:base="http://test.com/test.html?id=25>
<guid isPermaLink="false">25</guid>
<link>http://test.com/link.html</link>
<title>title test</title>
<description>Description test description test</description>
<a10:updated>2015-05-26T10:23:53Z</a10:updated>
<enclosure type="" url="http://test.com/test/test.jpg" width="200" height="200"/>
</item>
</channel>
我像这样提取了这个标签(标题测试):
title = ds.Tables["item"].Rows[0]["title"] as string;
如何用c#从<encosure>标签中提取url属性?
谢谢
【问题讨论】:
-
您能否澄清一下 - 您显示的这段代码
ds.Tables...与您显示的 xml 有什么关系?我想它与一些DataTable有关,而不是xml。 -
创建两个类(通道和项目),为成员(属性或元素)添加适当的xml标签并反序列化对象
标签: c# xml tags attributes xmlserializer