System.ServiceModel.Syndication 9.0.0-preview.3.24172.9
About
Provides types for generating and consuming RSS and Atom feeds. It is used for creating and parsing syndication feeds, making it easier to build and integrate web content syndication.
Key Features
- Easy generation and parsing of RSS and Atom feeds.
- Customizable for different syndication needs.
- Support for both feed reading and writing.
How to Use
Creating a Feed
using System.ServiceModel.Syndication;
using System.Xml;
// Create a new syndication feed
SyndicationFeed feed = new SyndicationFeed(
"Feed Title",
"Feed Description",
new Uri("http://example.com"),
"FeedID",
DateTime.Now);
// Add items to the feed
SyndicationItem item1 = new SyndicationItem(
"Title1",
"Content1",
new Uri("http://example.com/item1"));
feed.Items = new List<SyndicationItem> { item1 };
// Serialize the feed to RSS format
using (XmlWriter writer = XmlWriter.Create("rss.xml"))
{
Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(feed);
rssFormatter.WriteTo(writer);
}
Resulting RSS feed:
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Feed Title</title>
<link>http://example.com/</link>
<description>Feed Description</description>
<lastBuildDate>Sat, 11 Nov 2023 18:05:21 +0100</lastBuildDate>
<a10:id>FeedID</a10:id>
<item>
<link>http://example.com/item1</link>
<title>Title1</title>
<description>Content1</description>
</item>
</channel>
</rss>
Consuming a Feed
using System.ServiceModel.Syndication;
using System.Xml;
string feedUrl = "https://devblogs.microsoft.com/dotnet/feed/";
using XmlReader reader = XmlReader.Create(feedUrl);
// Read the feed using Atom10FeedFormatter.
SyndicationFeed feed = SyndicationFeed.Load(reader);
Console.WriteLine($"Feed Title: {feed.Title.Text}");
Console.WriteLine("Feed Items:");
// Iterate through the feed items and display the title and a brief summary of each.
foreach (SyndicationItem item in feed.Items)
{
Console.WriteLine($"Title: {item.Title.Text}");
Console.WriteLine($"Published Date: {item.PublishDate.DateTime}");
}
/*
* This code produces the following output:
*
* Feed Title: .NET Blog
* Feed Items:
* - Title: Join us for the Great .NET 8 Hack
* Published Date: 07/11/2023 18:05:00
* - Title: The convenience of System.IO
* Published Date: 06/11/2023 18:05:00
*/
Main Types
The main types provided by this library are:
System.ServiceModel.Syndication.SyndicationFeed
System.ServiceModel.Syndication.SyndicationItem
System.ServiceModel.Syndication.Rss20FeedFormatter
System.ServiceModel.Syndication.Atom10FeedFormatter
Additional Documentation
Feedback & Contributing
System.ServiceModel.Syndication is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
Showing the top 20 packages that depend on System.ServiceModel.Syndication.
Packages | Downloads |
---|---|
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
49 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
52 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
59 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
74 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET as well as .NET Standard.
|
83 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
|
61 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
|
74 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
10dc31ea70c14a33f371cea5a757a3d95b218acf
When using NuGet 3.x this package requires at least version 3.4.
|
62 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
8f968b9e79c5721d78cc88e46fe57457fe9d490d
When using NuGet 3.x this package requires at least version 3.4.
|
74 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
52 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
62 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
63 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
65 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
70 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
74 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
76 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
78 |
Microsoft.Windows.Compatibility
This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard.
When using NuGet 3.x this package requires at least version 3.4.
|
84 |
https://go.microsoft.com/fwlink/?LinkID=799421
.NET Framework 4.6.2
- No dependencies.
.NET 8.0
- No dependencies.
.NET 9.0
- No dependencies.
.NET Standard 2.0
- No dependencies.