AtomFeed 1.3.0

dotnet add package AtomFeed --version 1.3.0
                    
NuGet\Install-Package AtomFeed -Version 1.3.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AtomFeed" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AtomFeed" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="AtomFeed" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AtomFeed --version 1.3.0
                    
#r "nuget: AtomFeed, 1.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AtomFeed@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AtomFeed&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=AtomFeed&version=1.3.0
                    
Install as a Cake Tool

AtomFeed

latest version downloads tests status license

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:

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last Updated
1.3.0 219 11/14/2024
1.2.0 105 11/14/2024
1.1.0 112 11/13/2024
1.0.0 107 11/13/2024