using System;
using System.Xml;



/// Thanks to XNA ScreenSaver Project scaffolding code writers for borrowed and modified code.
/// Modification and distribution rights assumed.  Please contact if assumption in error.

namespace DarkWynter.Engine.Networking
{
    /// <summary>
    /// Representation of an Item element in an RSS 2.0 XML document.
    /// Zero or more RssItems are contained in an RssChannel.
    /// </summary>
    public class RssItem 
    {
        private readonly string title;
        private readonly string description;
        private readonly string link;

        public string Title { get { return title; } }
        public string Description { get { return description; } }
        public string Link { get { return link; } }


        /// <summary>
        /// Build an RSSItem from an XmlNode representing an Item element inside an RSS 2.0 XML document.
        /// </summary>
        /// <param name="itemNode"></param>
        internal RssItem(XmlNode itemNode)
        {
            XmlNode selected;
            selected = itemNode.SelectSingleNode("title");
            if (selected != null)
                title = selected.InnerText;

            selected = itemNode.SelectSingleNode("description");
            if (selected != null)
                description = selected.InnerText;

            selected = itemNode.SelectSingleNode("link");
            if (selected != null)
                link = selected.InnerText;
        }
    }
}