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

WriteRssFeed() private method

Writes a generated RSS syndication feed to the specified Stream using the supplied collection.
private WriteRssFeed ( Stream stream, IEnumerable publishables, string title ) : void
stream Stream /// The to which you want to write the syndication feed. ///
publishables IEnumerable /// The collection of objects used to generate the syndication feed content. ///
title string /// The title of the RSS channel. ///
return void
        private void WriteRssFeed(Stream stream, IEnumerable<IPublishable> publishables, string title)
        {
            var writerSettings = new XmlWriterSettings { Encoding = Encoding.UTF8, Indent = true };

            // ------------------------------------------------------------
            // Create writer against stream using defined settings
            // ------------------------------------------------------------
            using (var writer = XmlWriter.Create(stream, writerSettings))
            {
                writer.WriteStartElement("rss");
                writer.WriteAttributeString("version", "2.0");

                // ------------------------------------------------------------
                // Write XML namespaces used to support syndication extensions
                // ------------------------------------------------------------
                foreach (var prefix in SupportedNamespaces.Keys)
                {
                    writer.WriteAttributeString("xmlns", prefix, null, SupportedNamespaces[prefix]);
                }

                // ------------------------------------------------------------
                // Write <channel> element
                // ------------------------------------------------------------
                this.WriteRssChannel(writer, publishables, title);

                writer.WriteFullEndElement();
            }
        }