System.Text.Xml API proposed in dotnet/runtime issue 125299. It goes through the proposal section by section and gives, for each proposed type and member, the XmlEssentials name and a status. It’s for readers who know the proposal and want to see how much of it this library implements, and where it differs.
The comparison is against the proposal text as of November 2026 and the current XmlEssentials source. Each row was checked against the source.
How to read the tables
The proposal puts its types inSystem.Text.Xml and System.Text.Xml.Serialization. XmlEssentials uses CloudNimble.Text.Xml, CloudNimble.Text.Xml.Serialization, and CloudNimble.Text.Xml.Nodes.
The proposal names its types with XmlData (XmlDataSerializer, Utf8XmlDataReader, XmlDataElementAttribute) to keep them apart from the types in System.Xml. XmlEssentials uses the shorter names without Data (XmlSerializer, Utf8XmlReader, XmlElementAttribute), which follow the System.Text.Json names with Json replaced by Xml. Several of those names are also names in System.Xml and System.Xml.Serialization, so a file that imports both namespaces needs an alias.
Summary
Enums
Reader options and state
The state holds more than
JsonReaderState does. To resume inside a document, the reader needs the names of the open elements and the namespace declarations in scope, so CurrentState copies them. Only Options is public.
Reader
Utf8XmlDataReader is Utf8XmlReader, a ref struct.
Constructors
Properties
Methods
Writer options
Writer
Utf8XmlDataWriter is Utf8XmlWriter, a sealed class that implements IDisposable and IAsyncDisposable.
Serialization mapping attributes
The proposed attributes are inSystem.Text.Xml.Serialization and are named XmlData...Attribute. The XmlEssentials attributes are in CloudNimble.Text.Xml.Serialization.
One default differs from what the proposal’s examples show. A collection member with no attribute is written as one element for each item, with no wrapper element.
[XmlArray] adds the wrapper, as in the proposal’s Catalog example.
Serializer options
XmlDataSerializerOptions is XmlSerializerOptions. It’s a sealed class; the proposal doesn’t seal it.
Serializer
XmlDataSerializer is XmlSerializer, a static class. The type parameter is named TValue and the metadata parameter xmlTypeInfo.
The overloads that take options use reflection and are marked with
RequiresUnreferencedCode and RequiresDynamicCode. The overloads that take an XmlTypeInfo<T> or a context aren’t.
Custom converters
Source generation
Beyond the proposal
XmlEssentials also has these types, which the proposal doesn’t cover:The proposal’s usage examples
The following sections run the examples from the proposal’s “API Usage” section with XmlEssentials. Each is a tested sample, and the output shown is the real output. View the complete sample on GitHubBasic and span-based serialization
The proposal’sPerson is the Contact class here, with [XmlRoot("Person")].
Program.cs
Age comes before Name because Contact declares it first.
A reader over a sequence
Program.cs
Partial reads with reader state
The proposal’s loop reads each chunk with a new reader. This version also carries over the bytes that the previous reader didn’t consume, which the proposal’s loop leaves out.Program.cs
BytesConsumed counts from the start of the current buffer, as it does in Utf8JsonReader.
Namespace-aware mapping
The proposal’s example usesXmlDataNamespaceDeclaration to choose the prefix addr, and XmlDataType to put the members of Address in a namespace. XmlDataType has no counterpart, so this mapping names the namespace on each member, and it leaves the prefix to the writer:
Employee.cs
Program.cs
Address element, where the proposal’s output declares the prefix addr on the root. To declare that prefix on the document element, add [XmlNamespaceDeclaration("addr", "http://example.com/address")] to Employee. Address comes before FullName because the class declares HomeAddress first.
Polymorphic collections
Product.cs
Program.cs
A reader with namespace comparison
Program.cs
A writer with namespaces
Program.cs
Source generation
MigrationXmlContext.cs
Program.cs
OrderLine has an [XmlAttribute("sku")] member and an [XmlText] member. The context exposes Default and one XmlTypeInfo<T> property for each listed type, as the proposal’s AppXmlContext.Default.Person does.
See also
Why XmlEssentials
The background to the proposal and to this library.
Coming from System.Text.Json
The same API, mapped from the System.Text.Json names.
Use Utf8XmlReader
The reader in detail.
Use Utf8XmlWriter
The writer in detail.
Use source generation
Contexts, modes, and Native AOT.
XML conformance
What the reader accepts and rejects.