title: Loading xml file from URL into XDocument
body: <p>Apologies if this is a bit of a simple one, but I'm quite new to C#. In a WP7 app, I'm trying to load an XML file (specifically, a Blogger feed) into an XDocument using the XDocument.Load() method. However, when I try the following:</p>
  
  <pre><code>XDocument data = XDocument.Load("http://destroyedordamaged.blogspot.com/feeds/posts/default");
  </code></pre>
  
  <p>I get the error:</p>
  
  <p><em>Cannot open 'http://destroyedordamaged.blogspot.com/feeds/posts/default'. The Uri parameter must be a relative path pointing to content inside the Silverlight application's XAP package. If you need to load content from an arbitrary Uri, please see the documentation on Loading XML content using WebClient/HttpWebRequest</em></p>
  
  <p>So I had a look around, and found someone who suggested that I do this instead:</p>
  
  <pre><code>WebClient wc = new WebClient();
  wc.OpenReadCompleted += wc_OpenReadCompleted;
  wc.OpenReadAsync(new Uri("http://destroyedordamaged.blogspot.com/feeds/posts/default"));
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>private void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
      {
          if (e.Error != null)
          {
              Console.WriteLine("THERE IS AN ERROR: "+e.Error.Message);
              return;
          }
          using (Stream s = e.Result)
          {
              data = XDocument.Load(s);
          }
      } 
  </code></pre>
  
  <p>But this doesn't seem to work either; it loads nothing into the XDocument. Is there something I'm missing here? I'd like to find out the simplest way to load the xml from the feed into an XDocument.</p>
  
  <p>I had a look around, but it seems like everyone who has had a problem like this has been pointing their code at a specific .xml file rather than a URL without an extension like mine.</p>
  
  <p>I'd appreciate any input you can provide. Thanks a lot in advance.</p>