budul.LazyDataReader 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package budul.LazyDataReader --version 3.0.0
                    
NuGet\Install-Package budul.LazyDataReader -Version 3.0.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="budul.LazyDataReader" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="budul.LazyDataReader" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="budul.LazyDataReader" />
                    
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 budul.LazyDataReader --version 3.0.0
                    
#r "nuget: budul.LazyDataReader, 3.0.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 budul.LazyDataReader@3.0.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=budul.LazyDataReader&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=budul.LazyDataReader&version=3.0.0
                    
Install as a Cake Tool

LazyDataReader

NuGet License: MIT

XML reader on top of XmlSerializer that copes with files not matching the schema strictly: missing or additional namespaces, unknown attributes and decimal commas.

Installation

dotnet add package budul.LazyDataReader

Target framework: net10.0.

Usage

using LazyDataReader;

// Ignore the namespaces of the file, map all elements to the namespace of the class
var railML = Reader.GetFromFile<RailML2.RailML>(
    path: "Example.xml",
    classNamespace: "http://www.railml.org/schemas/2013");

// Keep selected foreign namespaces
var netex = Reader.GetFromFile<NeTEx.Light.PublicationDeliveryStructure>(
    path: "Line.xml",
    classNamespace: "http://www.netex.org.uk/netex",
    additionalNamespaces: ["http://www.opengis.net/gml/3.2"]);

// Remove unknown markup before deserialization
var custom = Reader.GetFromFile<RailML2.RailML>(
    path: "Custom.xml",
    classNamespace: "http://www.railml.org/schemas/2013",
    removalPatterns: @"xsi:type=""rhb[^""]*""");

// Decimal commas between digits
var rinf = Reader.GetFromFile<RINF.RINFData>(
    path: "Rinf.xml",
    replaceCommaInNumbers: true);

// From text instead of file
var data = Reader.GetFromText<MyType>(xml);
Parameter Effect
classNamespace Namespace of the target class. All elements of the file are read as if they were in this namespace, attributes get none. Without it, namespaces are ignored completely.
additionalNamespaces Namespaces of the file that are kept unchanged.
removalPatterns Regular expressions applied to every start tag (markup beginning with <), matches are removed.
replaceCommaInNumbers Replaces every comma between two digits with a dot, in the whole document including text and attribute values.
encoding Detected automatically (UTF.Unknown) if omitted.

Migration

2.x to 3.0.0

  • netstandard2.0 and netstandard2.1 are no longer supported, the package targets net10.0 only. Stay on 2.x for older targets.
  • DTD processing is ignored and external resolvers are disabled. Files with a <!DOCTYPE> are read without evaluating it.
  • Read errors are reported as InvalidDataException instead of ApplicationException.

Build and test

dotnet build
dotnet test

Requires Visual Studio 2026 or the .NET 10 SDK (see global.json). Tests run on xUnit v3 with Microsoft.Testing.Platform.

License

MIT, see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

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
3.1.0 89 11/30/2026
3.0.0 94 11/30/2026
2.0.0 442 10/21/2024
1.16.0 536 1/31/2023
1.15.0 490 1/25/2023
1.14.1 571 11/28/2022
1.14.0 528 11/28/2022
1.13.0 698 5/8/2022
1.12.0 717 1/27/2022
1.11.1 696 1/27/2022
1.11.0 689 1/27/2022
1.10.0 2,671 11/25/2021
1.9.0 583 5/26/2021
1.8.0 654 12/14/2020
1.7.0 680 12/14/2020
1.6.0 743 10/9/2020
1.5.0 700 10/6/2020
1.4.0 734 9/17/2020
1.3.0 737 7/7/2020
1.2.0 703 7/7/2020
Loading failed