Note that there are some explanatory texts on larger screens.

plurals
  1. POSelecting a XElement from a XDocument
    text
    copied!<p>I really didn't want to ask for help as I know I'll eventually figure it out, but I've spent too much time, if the document had parent tags or a better structure, it would be a piece of cake. Sadly I'm downloading the document, and I just can't figure out how to get the data.</p> <p>I've tried a a few linq queries and a foreach using XElement as an iterator. Anyway here's an example of the structure.</p> <pre><code>&lt;ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:srch" xsi:schemaLocation="urn:yahoo:srch http://api.search.yahoo.com/SiteExplorerService/V1/InlinkDataResponse.xsd" totalResultsAvailable="247930100" firstResultPosition="99" totalResultsReturned="100"&gt; &lt;Result&gt; &lt;Title&gt;Adobe - Adobe Reader&lt;/Title&gt; &lt;Url&gt;http://get.adobe.com/fr/reader/&lt;/Url&gt; &lt;ClickUrl&gt;http://get.adobe.com/fr/reader/&lt;/ClickUrl&gt; &lt;/Result&gt; &lt;Result&gt; &lt;Title&gt;Religious Tolerance&lt;/Title&gt; &lt;Url&gt;http://www.religioustolerance.org/&lt;/Url&gt; &lt;ClickUrl&gt;http://www.religioustolerance.org/&lt;/ClickUrl&gt; &lt;/Result&gt; &lt;Result&gt; &lt;Title&gt;Applications Internet riches (RIA) | Adobe Flash Player&lt;/Title&gt; &lt;Url&gt;http://www.adobe.com/fr/products/flashplayer/&lt;/Url&gt; &lt;ClickUrl&gt;http://www.adobe.com/fr/products/flashplayer/&lt;/ClickUrl&gt; &lt;/Result&gt; &lt;Result&gt; &lt;Title&gt;photo management software | Adobe Photoshop Lightroom 3&lt;/Title&gt; &lt;Url&gt;http://www.adobe.com/products/photoshoplightroom/&lt;/Url&gt; &lt;ClickUrl&gt;http://www.adobe.com/products/photoshoplightroom/&lt;/ClickUrl&gt; &lt;/Result&gt; &lt;Result&gt; &lt;Title&gt;Battle for Wesnoth&lt;/Title&gt; &lt;Url&gt;http://www.wesnoth.org/&lt;/Url&gt; &lt;ClickUrl&gt;http://www.wesnoth.org/&lt;/ClickUrl&gt; &lt;/Result&gt; &lt;/ResultSet&gt; </code></pre> <p>Here's an example of a latest snippet.</p> <pre><code>foreach (XElement ele in xDoc.Descendants("ResultSet").Elements("Result")) { CollectedUris.Add(ele.Element("Url").Value); } </code></pre>
 

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