AtomFeed 1.3.0
dotnet add package AtomFeed --version 1.3.0
NuGet\Install-Package AtomFeed -Version 1.3.0
<PackageReference Include="AtomFeed" Version="1.3.0" />
<PackageVersion Include="AtomFeed" Version="1.3.0" />
<PackageReference Include="AtomFeed" />
paket add AtomFeed --version 1.3.0
#r "nuget: AtomFeed, 1.3.0"
#:package AtomFeed@1.3.0
#addin nuget:?package=AtomFeed&version=1.3.0
#tool nuget:?package=AtomFeed&version=1.3.0
AtomFeed
The Atom Syndication Format is an XML language used for web feeds.
This project is a .NET implement of Atom 1.0.
Features
- Serialize atom feed into XML document
- Deserialize atom feed from XML
- Follows and conforms to W3C Atom feed validation
- Supports .NET 8 and .NET 9, Native AOT compatible
- Zero dependencies
Get Started
You may want to learn about the Atom from the links below:
- Atom (web standard) - Wikipedia (Include a comparison to the RSS 2.0)
- The Atom Syndication Format (RFC 4287) - IETF
Most of the modern feed readers support Atom.
You can use this library to build a feed server, or build an app to handle Atom feeds.
Installation
dotnet add package AtomFeed
Usage
Basic usage
Serialize:
using AtomFeed;
using AtomFeed.Element;
var feed = new Feed
{
Id = "urn:uuid:" + Guid.NewGuid().ToString(),
Title = "My Blog Feed",
Updated = DateTimeOffset.UtcNow,
Entries =
[
new Entry
{
Id = "urn:uuid:" + Guid.NewGuid().ToString(),
Title = "My First Article",
Updated = DateTimeOffset.UtcNow
}
]
};
var xmlDocument = Atom.Serialize(feed);
Deserialize:
using AtomFeed;
const string xml =
"""
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<id>urn:uuid:01931011-954d-71ee-ade5-0146811ae69f</id>
<title>Sample Feed</title>
<updated>2024-11-09T08:36:48Z</updated>
</feed>
""";
var feed = Atom.Deserialize(xml);
Strict mode in deserialization
Normally, the strict mode is disabled, when the giving feed is invalid, the parser will return null.
If the strict mode is enabled, the parser will throw an exception.
The strict mode can be used to validate the feed, it follows the W3C Atom feed validation.
var xml = string.Empty;
// A System.Data.ArgumentException will be thrown,
// because the feed is empty.
var feed = Atom.Deserialize(xml, true);
const string xml =
"""
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
</feed>
""";
// A System.Data.ConstraintException will be thrown,
// because the feed <id> tag is missing.
var feed = Atom.Deserialize(xml, true);
See more in the DeserializeStrictModeTests.cs
License
The MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.