这是我的代码:
var objectText = XmlReader.Create(requestedURL);
XmlSerializer mySerializer = new XmlSerializer(typeof(InstagramItems));
var instagramItems = (InstagramItems)mySerializer.Deserialize(objectText);
但似乎它不能与 RSS 一起使用(它们是“或多或少的 XML”):
Server Error - <rss xmlns=''> was not expected.
我该怎么做?我相信有.NET 库而不使用第三部分插件。
RSS 的一部分:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
<channel>
<title>Photos tagged as "example" on Instagram</title>
<link>http://instagram.com</link>
<description>Photos tagged as "example" on Instagram</description>
<atom:link href="http://instagram.com/tags/example/feed/recent.rss" rel="self" />
</channel>