1. Get RSS information through XmlDocument class
////// Get the feed seed data to be displayed /// /// /// ///public string LoadRSS (string RssUrl, int showNewsCount){string strRssList = "";string strMsg;try{XmlDocument objXMLDoc = new XmlDocument();objXMLDoc.Load(RssUrl); //Load XML document XmlNodeList objItems = objXMLDoc.GetElementsByTagName("item") ;//Get all matching elements if (showNewsCount> 30)showNewsCount = 10; //Show only 10 records if (showNewsCount <1)showNewsCount = objItems.Count;string title = "";string link = "";int i;if (objXMLDoc.HasChildNodes == true) //The document has child nodes (i = 1; foreach (XmlNode objNode in objItems) // loop all elements {if (i <= showNewsCount){if (objNode.HasChildNodes = = true){XmlNodeList objItemsChild = objNode.ChildNodes; //Get all the child nodes of the current element foreach (XmlNode objNodeChild in objItemsChild){switch (objNodeChild.Name){case "title":title = objNodeChild.InnerText;break;case " link":link = objNodeChild.InnerText;break; }}i = i + 1;strRssList += "" + title + "
";}}}}strMsg = strRssList;}catch{ strMsg = "RSS Feed source data error! ";}return strMsg;}
2. Update online RSS reading access via XMLHTTP without refreshing
Get the online RSS reading and dynamic update without refresh