BlogEngine.Core.SyndicationGenerator.WriteAtomContent C# (CSharp) Method

WriteAtomContent() private method

Writes the Atom feed element information to the specified XmlWriter using the supplied collection.
private WriteAtomContent ( XmlWriter writer, List publishables, string title ) : void
writer System.Xml.XmlWriter /// The to write channel element information to. ///
publishables List /// The collection of objects used to generate syndication content. ///
title string /// The title of the ATOM content. ///
return void
        private void WriteAtomContent(XmlWriter writer, List<IPublishable> publishables, string title)
        {
            // ------------------------------------------------------------
            // Write required feed elements
            // ------------------------------------------------------------
            writer.WriteElementString("id", Utils.AbsoluteWebRoot.ToString());
            writer.WriteElementString("title", title);

            var updated = publishables.Count > 0
                              ? ToW3CDateTime(publishables[0].DateModified.ToUniversalTime())
                              : ToW3CDateTime(DateTime.UtcNow);

            writer.WriteElementString(
                "updated",
                updated);

            // ------------------------------------------------------------
            // Write recommended feed elements
            // ------------------------------------------------------------
            writer.WriteStartElement("link");
            writer.WriteAttributeString("href", Utils.AbsoluteWebRoot.ToString());
            writer.WriteEndElement();

            writer.WriteStartElement("link");
            writer.WriteAttributeString("rel", "self");
            writer.WriteAttributeString("href", string.Format("{0}syndication.axd?format=atom", Utils.AbsoluteWebRoot));
            writer.WriteEndElement();

            // writer.WriteStartElement("link");
            // writer.WriteAttributeString("rel", "alternate");
            // writer.WriteAttributeString("href", Utils.FeedUrl.ToString());
            // writer.WriteEndElement();

            // ------------------------------------------------------------
            // Write optional feed elements
            // ------------------------------------------------------------
            writer.WriteElementString("subtitle", this.Settings.Description);

            // ------------------------------------------------------------
            // Write common/shared feed elements
            // ------------------------------------------------------------
            this.WriteAtomContentCommonElements(writer);

            // ------------------------------------------------------------
            // Skip publishable content if it is not visible
            // ------------------------------------------------------------
            foreach (var publishable in publishables.Where(publishable => publishable.IsVisible))
            {
                // ------------------------------------------------------------
                // Write <entry> element for publishable content
                // ------------------------------------------------------------
                WriteAtomEntry(writer, publishable);
            }
        }