public RssFeed()
        {
            XDocument = new XDocument();

            this.XElement = new XElement("rss", new XAttribute("version", "2.0"));
            XDocument.Add(XElement);

            Channels = new RssChannelCollection(XElement);
        }
        internal RssFeed(XDocument document)
        {
            XDocument = document;
            XElement = document.Element("rss");

            Channels = new RssChannelCollection(XElement);

            if (XElement.Name != "rss")
            {
                throw new WxfParseException();
            }
        }
Example #3
0
        /// <summary>Gets index of specified RSS Channel in the collection.</summary>
        /// <param name="channels">Target collection.</param>
        /// <param name="channel">Target channel.</param>
        /// <returns>Index if found, -1 otherwise.</returns>
        public static int IndexOf(RssChannelCollection channels, RssChannel channel)
        {
            int idx = 0;

            foreach (RssChannel ch in channels)
            {
                if (ch.Title == channel.Title && ch.Link == channel.Link)
                {
                    return(idx);
                }
                idx++;
            }
            return(-1);
        }
Example #4
0
 /// <summary>Gets if the specified RSS Channel is in the collection.</summary>
 /// <param name="channels">Target collection.</param>
 /// <param name="channel">Target channel.</param>
 /// <returns>true if found, false otherwise.</returns>
 public static bool Contains(RssChannelCollection channels, RssChannel channel)
 {
     return(IndexOf(channels, channel) >= 0);
 }