我試圖解析XML,這是在這個url:XDocument表示根級別的數據無效?
try
{
var xDoc = XDocument.Parse(requestedURL);
Response.Write("asd: " + xDoc.Descendants("entry").Count());
}
catch (Exception err)
{
Response.Write(err.Message);
}
,但它與Data at the root level is invalid. Line 1, position 1.
我在哪裏錯了回覆?
已經做到這一點,但'xDoc.Descendants( 「入口」)。COUNT()'說0,這是不是0,所以我想負荷不解析XML? – markzzz
@markzzz我更新了答案 – I4V
爲什麼我需要指定命名空間來提取這些數據?我第一次看到它... – markzzz