Akka.Streams.Xml 1.5.74

Prefix Reserved
dotnet add package Akka.Streams.Xml --version 1.5.74
                    
NuGet\Install-Package Akka.Streams.Xml -Version 1.5.74
                    
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="Akka.Streams.Xml" Version="1.5.74" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Akka.Streams.Xml" Version="1.5.74" />
                    
Directory.Packages.props
<PackageReference Include="Akka.Streams.Xml" />
                    
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 Akka.Streams.Xml --version 1.5.74
                    
#r "nuget: Akka.Streams.Xml, 1.5.74"
                    
#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 Akka.Streams.Xml@1.5.74
                    
#: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=Akka.Streams.Xml&version=1.5.74
                    
Install as a Cake Addin
#tool nuget:?package=Akka.Streams.Xml&version=1.5.74
                    
Install as a Cake Tool

Akka.Streams.Xml

NuGet version NuGet downloads

XML event parsing, adjacent-text coalescing and local-name path filtering for Akka.NET Streams. The package targets .NET Standard 2.0 and .NET 6. All three DSL flows materialize NotUsed; retain a terminal sink's task to observe completion or failure.

The current parser has an important input limitation: its XmlReader feeder can fail when a text/XML token is split between incoming byte chunks. The examples supply a complete, small UTF-8 fragment in one ByteString that fits the configured buffer. General arbitrary byte-stream parsing needs a separately reviewed parser improvement; a larger buffer alone is not a guarantee of arbitrary chunk support.

dotnet add package Akka.Streams.Xml

Parse a bounded XML fragment

XmlParsing.Parser(bufferSize: 1024) consumes ByteString values and emits IParseEvent values. The minimum feeder buffer size is 64 bytes; constructing a parser with a smaller value throws ArgumentException.

This complete example prints event kinds and content, including balanced start/end events for a self-closing item:

using Akka.Actor;
using Akka.IO;
using Akka.Streams;
using Akka.Streams.Dsl;
using Akka.Streams.Xml;
using Akka.Streams.Xml.Dsl;

var payload = ByteString.FromString("<root><item id='1'>café<![CDATA[ & more]]></item><item id='2'/></root>");
var system = ActorSystem.Create("xml-events", "akka.loglevel = WARNING");
try
{
    var events = await Source.Single(payload).Via(XmlParsing.Parser())
        .RunWith(Sink.Seq<IParseEvent>(), system.Materializer());
    foreach (var value in events)
    {
        var line = value switch
        {
            StartElement element => $"start:{element.LocalName}",
            EndElement element => $"end:{element.LocalName}",
            Characters text => $"text:{text.Text}",
            CData text => $"cdata:{text.Text}",
            Comment comment => $"comment:{comment.Text}",
            ProcessingInstruction instruction => $"pi:{instruction.Target} {instruction.Data}",
            _ => value.GetType().Name
        };
        Console.WriteLine(line);
    }
}
finally { await system.Terminate(); }

Events include StartDocument, EndDocument, StartElement, EndElement, Characters, CData, Comment and ProcessingInstruction. StartElement.Attributes is an immutable dictionary. The parser uses fragment conformance and can emit document boundaries for successive root fragments; those markers are adapter events rather than a lossless representation of XML declarations. Final events drain under demand and completion does not require a further request solely to discover EOF.

Names use XmlReader.LocalName: namespace URIs/prefixes are not preserved in element or attribute names. Attributes with different prefixes but the same local name can collide and fail with ArgumentException. Ignorable whitespace is suppressed, and other unhandled whitespace nodes are not represented. This event model is not a lossless XML roundtrip format.

Malformed XML and DTD input fail the tested parser path with XmlException. The stage owns its reader and memory feeder and disposes them when it stops. Cancellation propagates upstream; byte input already received may have been buffered or read ahead.

Coalesce text and select element contents

XmlParsing.Coalesce(maximumTextLength) joins consecutive Characters and CData events into one Characters event. Its maximum counts UTF-16 string code units across the consecutive text, not the number of events or input bytes. Exceeding it fails with IllegalStateException; it also flushes a final text sequence when upstream completes.

XmlParsing.Subslice(path) matches an exact, case-sensitive sequence of local element names from the root and emits the contents of each matching element, including nested descendants. It excludes the matched element's own opening/closing events. It is not XPath and does not match namespace URIs. An empty or null path passes events through.

This complete example coalesces the two text kinds and selects the contents of each root/item, printing café & more:

using System.Collections.Immutable;
using Akka.Actor;
using Akka.IO;
using Akka.Streams;
using Akka.Streams.Dsl;
using Akka.Streams.Xml;
using Akka.Streams.Xml.Dsl;

var payload = ByteString.FromString("<root><item id='1'>café<![CDATA[ & more]]></item><item id='2'/></root>");
var system = ActorSystem.Create("xml-selection", "akka.loglevel = WARNING");
try
{
    await Source.Single(payload)
        .Via(XmlParsing.Parser())
        .Via(XmlParsing.Coalesce(64))
        .Via(XmlParsing.Subslice(ImmutableList.Create("root", "item")))
        .Where(value => value is Characters)
        .Select(value => ((Characters)value).Text)
        .RunWith(Sink.ForEach<string>(Console.WriteLine), system.Materializer());
}
finally { await system.Terminate(); }

bufferSize controls the feeder allocation, not a maximum document, incoming chunk or total memory limit. Overflow bytes and the underlying reader can retain additional data. Coalescing limits adjacent emitted text only; it does not impose parser-wide document/entity/attribute limits. The package provides no schema validation, checkpoint/replay, automatic error recovery or universal untrusted-input resource guarantee.

The public StreamingXmlParser, Coalesce, Subslice and event classes remain available for compatibility; the DSL wraps those stages. The documented arbitrary-token chunking limitation, namespace information loss and broader parser redesign remain separate library work.

Tests

From the repository root:

dotnet test src/Xml/Akka.Streams.Xml.Tests/Akka.Streams.Xml.Tests.csproj -c Release --framework net10.0
# On Windows with .NET Framework 4.8:
dotnet test src/Xml/Akka.Streams.Xml.Tests/Akka.Streams.Xml.Tests.csproj -c Release --framework net48

Tests retain parsing, CDATA, path selection and text-limit assertions. Previously skipped coalescer cases now use real text/CData event streams, and a separate executed case characterizes unsupported parser text chunking. Added contracts cover self-closing roots/children/repeated fragments, completion with exact demand, trailing comments, malformed XML/DTD failures, UTF-8/local namespace names and cancellation. No Docker, Aspire host or cloud credentials are required.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.5.74 100 11/13/2026
1.5.59 791 1/27/2026
1.5.57 812 12/23/2025
1.5.40 1,701 4/18/2025
1.5.37 1,618 1/23/2025
1.5.33 1,627 12/26/2024
1.5.28 1,647 9/9/2024
1.5.18 1,674 3/29/2024
1.5.15 1,685 1/11/2024
1.5.8 1,798 6/30/2023
1.5.7 1,765 5/31/2023
1.5.0.1 1,870 3/7/2023
1.5.0 1,834 3/3/2023
1.4.49 1,789 3/3/2023
1.0.1-beta4 671 10/21/2022
1.0.1-beta3 322 10/21/2022
1.0.1-beta2 338 7/25/2022
1.0.1-beta1 357 6/8/2022
1.0.0-beta9 368 3/17/2022
1.0.0-beta8 397 12/21/2021
Loading failed

* Bump the minimum Akka.NET dependency to [1.5.74](https://github.com/akkadotnet/akka.net/releases/tag/1.5.74), with aligned Streams and TestKit dependencies.
* Include an individual README in each of the twelve connector packages, with usage, ownership, delivery semantics, limitations and linked NuGet version/download badges. Expand the repository README and documentation navigation.
* Update compatible Azure, AWS, AMQP and SignalR dependencies. Package READMEs document remaining SDK support and version limitations.
* Azure Service Bus JSON sources await successful message completion before emitting values and propagate settlement failures.
* Fix SQS batch-response correlation when response entries arrive in a different order.
* Improve SNS and Kinesis completion, cancellation and failure handling.
* Remove blocking SignalR send waits while preserving sequential delivery and existing materialized values.
* Propagate AMQP conversion and connection failures through the materialized completion task.
* Correct CSV parsing across split CRLF/escape sequences and XML parser empty-element/document completion, including reader and feeder cleanup.
* Improve rotating-file sink cleanup on completion and failures.
* Add required service integration, package/API, unchanged-consumer and packaged-example validation. Harden Event Hubs startup and Service Bus polling tests.
* Replace legacy FluentAssertions usages with xUnit assertions, retaining their payload, ordering, exception and deadline checks.
* Mark the historical `Akka.Streams.Channels`, `Akka.Streams.Azure.EventHub.V5` and `Akka.Streams.SignalR.AspNetCore` packages as Legacy on NuGet. See the [migration guide](https://alpakka.getakka.net/documentation/LegacyPackages.html) for their maintained replacements and compatibility requirements.

**Upstream compatibility:** Alpakka retains its public APIs and library targets. Raising the Akka.NET minimum from 1.5.60 inherits upstream binary changes: the old `RetrySupport.Retry` overload with an `int randomFactor` is replaced by a `double` overload, and `ISourceQueue<T>` requires `OfferAsync(T, CancellationToken)`. Applications using that old compiled overload or custom queue implementations need to update and rebuild against the new dependencies.