Exemplo n.º 1
0
        /// <summary>
        /// Creates an RSS item from an XML node with the 
        /// corresponding child nodes (title,description etc.)
        /// </summary>
        /// <param name="xmlNode">The node to extract the details from</param>
        /// <returns>An RssItem object with details taken from the item node.</returns>
        private RssItem getRssItem(XmlNode xmlNode)
        {
            RssItem rssItem = new RssItem();

              for (int i = 0; i < xmlNode.ChildNodes.Count; i++)
              {
            switch (xmlNode.ChildNodes[i].Name.ToLower())
            {
              case "title":
            {
              rssItem.Title = xmlNode.ChildNodes[i].InnerText;
              break;
            }
              case "description":
            {
              rssItem.Description = xmlNode.ChildNodes[i].InnerText;
              break;
            }
              case "link":
            {
              rssItem.Link = xmlNode.ChildNodes[i].InnerText;
              break;
            }
              case "author":
            {
              rssItem.Author = xmlNode.ChildNodes[i].InnerText;
              break;
            }
              case "comments":
            {
              rssItem.Comments = xmlNode.ChildNodes[i].InnerText;
              break;
            }
              case "pubdate":
            {
              rssItem.PubDate = xmlNode.ChildNodes[i].InnerText;
              break;
            }
              case "guid":
            {
              rssItem.Guid = xmlNode.ChildNodes[i].InnerText;
              break;
            }
            }
              }

              return rssItem;
        }
Exemplo n.º 2
0
 public void Add(RssItem rssItem)
 {
     List.Add(rssItem);
 }