Example #1
0
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        /// <summary>
        /// Loads the properties of the RssCoreItem class with the contents of the parent element
        /// </summary>
        /// <param name="el">XElement</param>
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        public void LoadEl(XElement el)
        {
            RssRfc822DateTimeConverter dtConvert = new RssRfc822DateTimeConverter();

            switch (el.Name.LocalName)
            {
            case TAG_TITLE:
                title = xUtil.GetStr(el);
                break;

            case TAG_LINK:
                link = xUtil.GetStr(el);
                break;

            case TAG_DESCRIPTION:
                description = xUtil.GetStr(el);
                break;

            case TAG_AUTHOR:
                author = xUtil.GetStr(el);
                break;

            case TAG_CATEGORY:
                RssCoreItemCategory ctg = new RssCoreItemCategory();
                ctg.Load(el);
                categories.Add(ctg);
                break;

            case TAG_COMMENTS:
                comments = xUtil.GetStr(el);
                break;

            case TAG_ENCLOSURE:
                RssCoreItemEnclosure enc = new RssCoreItemEnclosure();
                enc.Load(el);
                enclosures.Add(enc);
                break;

            case TAG_GUID:
                guid = new RssCoreItemGuid();
                guid.Load(el);
                break;

            case TAG_PUBDATE:
                pubDate = dtConvert.ParseRfc822(xUtil.GetStr(el));
                break;

            case TAG_SOURCE:
                source = new RssCoreItemSource();
                source.Load(el);
                break;
            }   // end switch
        }
Example #2
0
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        /// <summary>
        /// Sets the property based upon the tag name of the provided XElement
        /// </summary>
        /// <param name="el">XElement</param>
        // -------------------------------------------------------------------------------
        // -------------------------------------------------------------------------------
        public void LoadEl(XElement el)
        {
            RssRfc822DateTimeConverter dtConvert = new RssRfc822DateTimeConverter();

            if (el.Name.Namespace == XNamespace.None)
            {
                switch (el.Name.LocalName)
                {
                case TAG_TITLE:
                    title = xUtil.GetStr(el);
                    break;

                case TAG_LINK:
                    link = xUtil.GetStr(el);
                    break;

                case TAG_DESCRIPTION:
                    description = xUtil.GetStr(el);
                    break;

                case TAG_LANGUAGE:
                    language = xUtil.GetStr(el);
                    break;

                case TAG_COPYRIGHT:
                    copyright = xUtil.GetStr(el);
                    break;

                case TAG_MANAGINGEDITOR:
                    managingEditor = xUtil.GetStr(el);
                    break;

                case TAG_WEBMASTER:
                    webMaster = xUtil.GetStr(el);
                    break;

                case TAG_PUBDATE:
                    pubDate = dtConvert.ParseRfc822(xUtil.GetStr(el));
                    break;

                case TAG_LASTBUILDDATE:
                    lastBuildDate = dtConvert.ParseRfc822(xUtil.GetStr(el));
                    break;

                case TAG_CATEGORY:
                    RssCoreChannelCategory ctg = new RssCoreChannelCategory();
                    ctg.Load(el);
                    categories.Add(ctg);
                    break;

                case TAG_GENERATOR:
                    generator = xUtil.GetStr(el);
                    break;

                case TAG_DOCS:
                    docs = xUtil.GetStr(el);
                    break;

                case TAG_CLOUD:
                    RssCoreChannelCloud c = new RssCoreChannelCloud();
                    c.Load(el);
                    cloud.Add(c);
                    break;

                case TAG_TTL:
                    ttl = xUtil.GetInt(el);
                    break;

                case TAG_IMAGE:
                    image = new RssCoreChannelImage();
                    image.Load(el);
                    break;

                case TAG_TEXTINPUT:
                    textInput = new RssCoreChannelTextInput();
                    textInput.Load(el);
                    break;

                case TAG_SKIPHOURS:
                    skipHours = new RssCoreChannelSkipHours();
                    skipHours.Load(el);
                    break;

                case TAG_SKIPDAYS:
                    skipDays = new RssCoreChannelSkipDays();
                    skipDays.Load(el);
                    break;
                } // end switch
            }     // end if namespace
        }