Пример #1
0
        private void WriteAtomFeed(IPublicationFeed feed, Stream writeStream)
        {
            var formatter = new Atom10FeedFormatter(feed.Syndicate());

            using (var writer = XmlWriter.Create(writeStream)) {
                formatter.WriteTo(writer);
            }
        }
        /// <summary>
        /// Writes the atom feed to the specified stream.
        /// </summary>
        /// <param name="feed">The publication feed containing the entries.</param>
        /// <param name="writeStream">The output write stream.</param>
        /// <param name="contentType">The media type header requested.</param>
        protected virtual void WriteFeed(IPublicationFeed feed, Stream writeStream, string contentType)
        {
            var syndicationfeed = feed.Syndicate();

            syndicationfeed.Items = feed.Items.Select(x => x.Syndicate());
            var formatter = GetFormatter(contentType, syndicationfeed);

            using (var writer = XmlWriter.Create(writeStream, new XmlWriterSettings()
            {
                Indent = true
            }))
            {
                formatter.WriteTo(writer);
            }
        }
        private void WriteAtomFeed(IPublicationFeed feed, Stream writeStream)
        {
            var formatter = new Atom10FeedFormatter(feed.Syndicate());

            using (var writer = XmlWriter.Create(writeStream))
            {
                formatter.WriteTo(writer);
            }
        }