/// <summary>takes the updated entry returned and sets the properties to this object</summary>
        /// <param name="updatedEntry"> </param>
        protected void CopyEntry(AtomEntry updatedEntry)
        {
            Tracing.Assert(updatedEntry != null, "updatedEntry should not be null");
            if (updatedEntry == null)
            {
                throw new ArgumentNullException("updatedEntry");
            }

            _title           = updatedEntry.Title;
            _authors         = updatedEntry.Authors;
            _id              = updatedEntry.Id;
            _links           = updatedEntry.Links;
            _lastUpdateDate  = updatedEntry.Updated;
            _publicationDate = updatedEntry.Published;
            _authors         = updatedEntry.Authors;
            _rights          = updatedEntry.Rights;
            _categories      = updatedEntry.Categories;
            _summary         = updatedEntry.Summary;
            _content         = updatedEntry.Content;
            _source          = updatedEntry.Source;

            ExtensionElements.Clear();

            foreach (IExtensionElementFactory extension in updatedEntry.ExtensionElements)
            {
                ExtensionElements.Add(extension);
            }
        }
        /// <summary>tries to parse a category collection document</summary>
        /// <param name="reader"> xmlReader positioned at the start element</param>
        /// <param name="owner">the base object that the collection belongs to</param>
        /// <returns></returns>
        public AtomCategoryCollection ParseCategories(XmlReader reader, AtomBase owner)
        {
            Tracing.Assert(reader != null, "reader should not be null");
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            AtomCategoryCollection ret = new AtomCategoryCollection();

            MoveToStartElement(reader);

            Tracing.TraceCall("entering Categories Parser");
            object localname = reader.LocalName;

            Tracing.TraceInfo("localname is: " + reader.LocalName);

            if (IsCurrentNameSpace(reader, BaseNameTable.AppPublishingNamespace(owner)) &&
                localname.Equals(_nameTable.Categories))
            {
                Tracing.TraceInfo("Found categories  document");
                int depth = -1;
                while (NextChildElement(reader, ref depth))
                {
                    localname = reader.LocalName;
                    if (IsCurrentNameSpace(reader, BaseNameTable.NSAtom))
                    {
                        if (localname.Equals(_nameTable.Category))
                        {
                            AtomCategory category = ParseCategory(reader, owner);
                            ret.Add(category);
                        }
                    }
                }
            }
            else
            {
                Tracing.TraceInfo("ParseCategories called and nothing was parsed" + localname);
                throw new ClientFeedException("An invalid Atom Document was passed to the parser. This was not an app:categories document: " + localname);
            }

            return(ret);
        }
Example #3
0
        /// <summary>public AtomSource(AtomFeed feed)</summary>
        public AtomSource(AtomFeed feed)
            : this()
        {
            Tracing.Assert(feed != null, "feed should not be null");
            if (feed == null)
            {
                throw new ArgumentNullException("feed");
            }

            // now copy them
            _authors      = feed.Authors;
            _contributors = feed.Contributors;
            _categories   = feed.Categories;
            Generator     = feed.Generator;
            Icon          = feed.Icon;
            Logo          = feed.Logo;
            Id            = feed.Id;
            _links        = feed.Links;
            Rights        = feed.Rights;
            Subtitle      = feed.Subtitle;
            Title         = feed.Title;
            Updated       = feed.Updated;
        }