ISO20022.Parser
1.2.0
dotnet add package ISO20022.Parser --version 1.2.0
NuGet\Install-Package ISO20022.Parser -Version 1.2.0
<PackageReference Include="ISO20022.Parser" Version="1.2.0" />
<PackageVersion Include="ISO20022.Parser" Version="1.2.0" />
<PackageReference Include="ISO20022.Parser" />
paket add ISO20022.Parser --version 1.2.0
#r "nuget: ISO20022.Parser, 1.2.0"
#addin nuget:?package=ISO20022.Parser&version=1.2.0
#tool nuget:?package=ISO20022.Parser&version=1.2.0
ISO 20022 Parsing .Net 8 Library
ISO20022.Parser is a .NET 8 library designed to parse ISO 20022 messages in the fastest way possible using predefined rule sets.
NOTE: MXParser has been deprecated. Please switch to ISO20022.Parser.
Features
- Parse ISO 20022 XML messages with pre-defined rules.
- Rules can be in JSON structure or database structure.
- High performance: Parses large XML files efficiently.
Performance Note
The library can parse a 60.6MB XML data file containing 129,769 <Ntry> records , in 6 seconds on a machine with 4 cores, 8 logical processors, and 16GB of RAM.
Installation
Install the ISO20022.Parser
NuGet package:
.NET CLI
dotnet add package ISO20022.Parser
Package Manager
Install-Package ISO20022.Parser
Features in Detail
Parsing ISO 20022 Messages
Here is an example of how to use the library to parse ISO 20022 messages:
using System.Data;
using System.Diagnostics;
using ISO20022.Parser;
public class Program
{
private static async Task Main(string[] args)
{
Stopwatch stopwatch = new();
stopwatch.Start();
IParsingService parsingService = new ParsingService(new ParsingJsonRules(@"data\parsing_rules.json"), "Document");
await parsingService.ParseXmlAsync(@"data\camt.053.xml", (DataSet ds, Guid messageUniqueId, Guid uniquiId) =>
{
Task task = Task.Run(() =>
{
string dateTime = DateTime.Now.ToString("ddmmyyyyHHmmssfff");
foreach (DataTable dt in ds.Tables)
{
ExportDataTableToCsv(dt, @$"export\{dt.TableName}_{uniquiId}.csv");
}
});
return task;
});
stopwatch.Stop();
TimeSpan elapsedTime = stopwatch.Elapsed;
Console.WriteLine("Elapsed Time: " + elapsedTime);
Console.Read();
}
static void ExportDataTableToCsv(DataTable dataTable, string filePath)
{
if (!File.Exists(filePath))
{
File.Create(filePath).Close();
}
using (StreamWriter writer = new StreamWriter(filePath))
{
foreach (DataColumn column in dataTable.Columns)
{
writer.Write(column.ColumnName);
writer.Write(",");
}
writer.WriteLine();
foreach (DataRow row in dataTable.Rows)
{
foreach (object item in row.ItemArray)
{
writer.Write(item);
writer.Write(",");
}
writer.WriteLine();
}
}
}
}
Parsing Rules
Follow the parsing rules example provided in the data
directory of the repository.
Mapping rules should follow the below model class structure:
public class MappingRules
{
public string Namespace { get; set; }
public List<MappingTable> Mappings { get; set; }
}
public class MappingTable
{
public string NodeName { get; set; }
public string XPath { get; set; }
public IList<MappingColumn> Columns { get; set; }
}
public class MappingColumn
{
public int OrderNumber { get; set; }
public string NodeName { get; set; }
public string XPath { get; set; }
public string DataType { get; set; }
public int MinLength { get; set; }
public int MaxLength { get; set; }
public int fractionDigits { get; set; }
public int totalDigits { get; set; }
}
Overriding Parsing Rules
If you want to store parsing rules in a database, override the DeserializeRules
method in the ParsingRules
class.
For example:
public class ParsingDatabaseRules : ParsingRules
{
public override void DeserializeRules()
{
MapParsingRules = GetMyRulesFromDB();
}
}
Sample Files
XML file with 129,769 <Ntry/> entries. 60 Mb of file.
License
This project is licensed under the Apache 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 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. |
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ISO20022.Parser:
Package | Downloads |
---|---|
ISO20022.Suite
ISO 20022 is the dotnet library which help to parse, create ISO 200022 messages in the fastes way possible with the predefined rule sets. It also helps to convert your ISO 20022 XSD to JSON |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.0 | 189 | 4/15/2025 |
1.0.1 | 135 | 10/16/2024 |
1.0.0 | 154 | 9/4/2024 |
1.0.0-beta | 98 | 9/4/2024 |