Beispiel #1
0
        /// <summary>
        /// Writes items from an ATOM feed.
        /// </summary>
        /// <param name="xmlDocument"></param>
        /// <param name="xmlWriter"></param>
        private void WriteAtomItems(XmlDocument xmlDocument, RssChannel rssChannel)
        {
            NCEncoding  encoding = NCEncoding.String;
            DateTime    now      = DateTime.Now;
            XmlNodeList xmlNodes = xmlDocument.SelectNodes("/atom:feed//atom:entry", FeedManager.NsManager);

            foreach (XmlNode xmlNode in xmlNodes)
            {
                RssItem rssItem = new RssItem();
                rssItem.Title        = FeedManager.GetNodeContent(xmlNode, "atom:title");
                rssItem.Link         = FeedManager.GetNodeContent(xmlNode, "atom:link[@rel=\"alternate\" and @type=\"text/html\"]/@href");
                rssItem.Published    = FeedManager.GetNodeContentFrom(xmlNode, s_arrAtomPubDate, ref encoding);
                rssItem.ReceivedDate = now;
                rssItem.Author       = FeedManager.GetNodeContent(xmlNode, "atom:author/atom:name");
                rssItem.Description  = FeedManager.GetNodeContentFrom(xmlNode, s_arrAtomDesc, ref encoding);
                rssItem.Encoding     = encoding;
                rssChannel.AddItem(rssItem);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Writes items from an RSS feed.
        /// </summary>
        /// <param name="xmlDocument"></param>
        /// <param name="xmlWriter"></param>
        private void WriteRssItems(XmlDocument xmlDocument, RssChannel rssChannel)
        {
            NCEncoding  encoding = NCEncoding.String;
            DateTime    now      = DateTime.Now;
            XmlNodeList xmlNodes = xmlDocument.SelectNodes("/rss/channel//item", FeedManager.NsManager);

            foreach (XmlNode xmlNode in xmlNodes)
            {
                RssItem rssItem = new RssItem();
                rssItem.Title        = FeedManager.GetNodeContent(xmlNode, "title");
                rssItem.Link         = FeedManager.GetNodeContent(xmlNode, "link");
                rssItem.Published    = FeedManager.GetNodeContentFrom(xmlNode, s_arrRssPubDate, ref encoding);
                rssItem.ReceivedDate = now;
                rssItem.Author       = FeedManager.GetNodeContentFrom(xmlNode, s_arrRssAuthor, ref encoding);
                rssItem.Description  = FeedManager.GetNodeContentFrom(xmlNode, s_arrRssDesc, ref encoding);
                rssItem.Category     = FeedManager.GetNodeContent(xmlNode, "category");
                rssItem.Encoding     = encoding;
                rssItem.Enclosure    = FeedManager.GetEnclosure(xmlNode, "enclosure");
                rssChannel.AddItem(rssItem);
            }
        }