簡體   English   中英

XDocument加載-無法打開

[英]XDocument Load - cannot open

我正在嘗試通過XDocument加載rss feed。 網址是:

http://www.ft.com/rss/home/uk

XDocument doc = XDocument.Load(url);

但是我遇到一個錯誤:

Cannot open 'http://www.ft.com/rss/home/uk'. The Uri parameter must be a file system relative or absolute path.

XDocument.Load不接受URL,僅接受文檔中所述的文件

嘗試類似以下我完全沒有測試過的代碼:

using(var httpclient = new HttpClient())
{
    var response = await httpclient.GetAsync("http://www.ft.com/rss/home/uk");
    var xDoc = XDocument.Load(await response.Content.ReadAsStreamAsync());
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM