BlogEngine.Core.SyndicationGenerator.WriteAtomFeed C# (CSharp) Méthode

WriteAtomFeed() private méthode

Writes a generated Atom syndication feed to the specified Stream using the supplied collection.
private WriteAtomFeed ( Stream stream, List publishables, string title ) : void
stream Stream /// The to which you want to write the syndication feed. ///
publishables List /// The collection of objects used to generate the syndication feed content. ///
title string /// The title of the ATOM content. ///
Résultat void
        private void WriteAtomFeed(Stream stream, List<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("feed", "http://www.w3.org/2005/Atom");

                // writer.WriteAttributeString("version", "1.0");

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

                // ------------------------------------------------------------
                // Write feed content
                // ------------------------------------------------------------
                this.WriteAtomContent(writer, publishables, title);

                writer.WriteFullEndElement();
            }
        }