Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your missing the namespace. Using <a href="http://www.linqpad.net/" rel="noreferrer" title="LINQPad">LINQPad</a> and your example feed:</p> <pre><code>string xml = @" &lt;rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/'&gt; &lt;channel&gt; &lt;title&gt;Title of RSS feed&lt;/title&gt; &lt;link&gt;http://www.google.com&lt;/link&gt; &lt;description&gt;Details about the feed&lt;/description&gt; &lt;pubDate&gt;Mon, 24 Nov 08 21:44:21 -0500&lt;/pubDate&gt; &lt;language&gt;en&lt;/language&gt; &lt;item&gt; &lt;title&gt;Article 1&lt;/title&gt; &lt;description&gt;&lt;![CDATA[How to use StackOverflow.com]]&gt;&lt;/description&gt; &lt;link&gt;http://youtube.com/?v=y6_-cLWwEU0&lt;/link&gt; &lt;media:player url='http://youtube.com/?v=y6_-cLWwEU0' /&gt; &lt;media:thumbnail url='http://img.youtube.com/vi/y6_-cLWwEU0/default.jpg' width='120' height='90' /&gt; &lt;media:title&gt;Jared on StackOverflow&lt;/media:title&gt; &lt;media:category label='Tags'&gt;tag1, tag2&lt;/media:category&gt; &lt;media:credit&gt;Jared&lt;/media:credit&gt; &lt;enclosure url='http://youtube.com/v/y6_-cLWwEU0.swf' length='233' type='application/x-shockwave-flash'/&gt; &lt;/item&gt; &lt;/channel&gt; &lt;/rss&gt; "; XElement rss = XElement.Parse( xml ); XNamespace media = "http://search.yahoo.com/mrss/"; var player = rss.Element( "channel" ).Element( "item" ).Element(media + "player").Attribute( "url" ); player.Dump(); </code></pre> <p>result: url="http://youtube.com/?v=y6_-cLWwEU0"</p> <p>The construct to look at is: Element(media + "player") that tells Linq to use the namespace represented by 'media' as well as the element name 'player'.</p> <p><strong>Brain damage must be setting in on my part, I thought you were using Linq. Anyway, you need to take the namespace into consideration.</strong></p>
    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.
 

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