我做了以下內容:的XMLDocument,問題讀節點
System.Net.WebRequest myRequest = System.Net.WebRequest.Create("http://www.atlantawithkid.com/feed/");
System.Net.WebResponse myResponse = myRequest.GetResponse();
System.IO.Stream rssStream = myResponse.GetResponseStream();
System.Xml.XmlDocument rssDoc = new System.Xml.XmlDocument();
rssDoc.Load(rssStream);
System.Xml.XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel/item");
System.Xml.XmlNode rssDetail;
// FEED DESCRIPTION
string sRssDescription;
rssDetail = rssItems.Item(0).SelectSingleNode("description");
if (rssDetail != null)
sRssDescription = rssDetail.InnerText;
但是,當我讀到「說明」節點並查看的innerText或InnerXML,字符串比原始XML文檔中的不同。
字符串返回有橢圓和數據si被截斷。但是,在原始XML文檔中有我可以看到的數據。
有沒有辦法選擇這個節點,而不會改變數據?
感謝您的幫助。
這聽起來很奇怪。您可以將數據流式傳輸到文本文件,而不是將數據流式傳輸到XmlDocument中,並確認數據未被截斷? – code4life 2010-09-23 13:42:40
是的,我做到了,有趣的是它也得到了橢圓。但是,原始文檔沒有它們。我相信它與System.Net.WebRequest.Create,GetReponse或GetResponseStream有關。 – LilMoke 2010-09-23 14:25:37