Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you edited your rss tag to remove the namespaces? This works fine for me, notice the "xmlns:thr" and "xmlns:feedburner" in the rss element:</p> <pre><code>private void buttonTest1_Click(object sender, RoutedEventArgs e) { string sResult = @"&lt;rss xmlns:thr=""http://www.itunes.com/dtds/random.dtd"" xmlns:feedburner=""http://rssnamespace.org/feedburner/ext/1.0""&gt; &lt;channel&gt; &lt;item&gt; &lt;guid isPermaLink=""false""&gt;tag:blogger.com,1999:blog-811823720557864449.post-3786706865099847612&lt;/guid&gt; &lt;pubDate&gt;Sun, 20 Feb 2011 02:08:00 +0000&lt;/pubDate&gt; &lt;title&gt;#43 - StarCast: ""Mork's Homecoming!""&lt;/title&gt; &lt;link&gt;http://starcastshow.blogspot.com/2011/02/43-starcast-morks-homecoming.html&lt;/link&gt; &lt;author&gt;starcastshow@gmail.com (Garrett Weinzierl &amp;amp; Kyle Fergusson)&lt;/author&gt; &lt;thr:total&gt;1&lt;/thr:total&gt; &lt;enclosure url=""http://feedproxy.google.com/~r/starcast_rss/~5/Xf0YXRRMrPU/episode_43.mp3"" length=""0"" type=""audio/mpeg"" /&gt; &lt;feedburner:origEnclosureLink&gt;http://thestarcast.com/shows/starcast/episode_43.mp3&lt;/feedburner:origEnclosureLink&gt; &lt;/item&gt; &lt;/channel&gt; &lt;/rss&gt;"; XElement xmlRssItems = XElement.Parse(sResult); var result = from rssItem in xmlRssItems.Element("channel").Elements("item") select new PodcastItem { Title = (string)rssItem.Element("title"), MyUrl = new Uri(rssItem.Element("enclosure").Attribute("url").Value) }; Console.WriteLine("{0}", result); } </code></pre> <p>Another way to handle it would be to add the namespaces and use XmlReader to load your element:</p> <pre><code>XmlNamespaceManager xnm = new XmlNamespaceManager(new NameTable()); xnm.AddNamespace("thr", ""); xnm.AddNamespace("feedburner", ""); XmlParserContext xpc = new XmlParserContext(null, xnm, null, XmlSpace.None); XmlTextReader xtr = new XmlTextReader(sResult, XmlNodeType.Element, xpc); XElement xmlRssItems = XElement.Load(xtr); var result = from rssItem in xmlRssItems.Element("channel").Elements("item") select new PodcastItem { Title = (string)rssItem.Element("title"), MyUrl = new Uri(rssItem.Element("enclosure").Attribute("url").Value), Total = (string)rssItem.Element("total"), OriginalEnclosureLink = (string)rssItem.Element("origEnclosureLink") }; Console.WriteLine("{0}", result); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload