VeritasData.Net.FacturX.Xml 1.0.0-rc.7

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

VeritasData.Net.FacturX.Xml

Libraries for creating, serializing, reading, and validating the EN16931 XML profile of Factur-X 1.09.2 / ZUGFeRD 2.5.2.

The public XML model is generated from the official profile schemas, including all schema-defined elements and attributes. Services are stateless and suitable for singleton dependency injection. Compiled schema and stylesheet metadata are shared; invoice documents, readers, transforms, and diagnostics are not.

Projects and Packages

Package Responsibility
VeritasData.Net.FacturX.Xml Typed models, strict XML serialization, decimal calculations, and core DI registration
VeritasData.Net.FacturX.Xml.Validation Optional offline XSD and Schematron validation, diagnostics, embedded standards, and validation DI registration

Validation references the XML library, never the reverse. Only the validation package depends on SaxonCS-HE. Serialization-only applications need only the XML project or package; applications that validate invoices also reference validation. Public C# namespaces and invoice model types are unchanged by this separation.

Supported Scope

Area Support
XML core targets netstandard2.0 and net10.0
Validation target net10.0 (required by SaxonCS-HE 13.1.0)
Standard release Factur-X 1.09.2 / ZUGFeRD 2.5.2
Profile EN16931
Guideline ID urn:cen.eu:en16931:2017
XML model Complete bindings for the official EN16931 schemas
Serialization Strict typed reading; UTF-8 output without a BOM
Validation Official XSD, Schematron XSLT 2.0, and embedded code lists
Runtime resources Embedded and offline; no filesystem or network resolution
Calculations Explicit decimal line-net and VAT helpers

MINIMUM, BASIC WL, BASIC, EXTENDED, XRechnung, French national overlays, PDF/A creation, XML extraction from PDFs, and XML embedding into PDFs are not included in this release. A valid XML result does not certify legal compliance, the identity of invoice parties, PDF/A conformance, or agreement with a visible PDF.

Build and Test

Use a .NET 10 SDK. The supplied XML projects were developed with the .NET 10.0.4xx SDK.

dotnet restore VeritasData.Net.FacturX.slnx --locked-mode
dotnet build VeritasData.Net.FacturX.slnx --configuration Release --no-restore
dotnet test VeritasData.Net.FacturX.slnx --configuration Release --no-build --no-restore
dotnet pack VeritasData.Net.FacturX.slnx --configuration Release --no-build --no-restore --output artifacts/packages

The tests use the VSTest adapter, not Microsoft.Testing.Platform. The combined repository's Azure pipeline builds, tests, runs the example, and packages on Windows.

To test the portable XML core and PDF assemblies, rebuild the test suite with:

dotnet test VeritasData.Net.FacturX.slnx --configuration Release -p:UseNetStandardLibraries=true

The tests assert which target assemblies were loaded. Their host and the validation engine remain on .NET 10; this does not verify execution on .NET Framework. Do not use --no-build when switching test modes.

Dependency Injection

For XML serialization and calculations without validation:

using VeritasData.Net.FacturX.Xml;
using VeritasData.Net.FacturX.Xml.DependencyInjection;

services.AddFacturXXml(new FacturXXmlOptions
{
    MaxCharactersInDocument = 16_777_216,
    Indent = true
});

Resolve IFacturXSerializer and IFacturXAmountCalculator from the application container. AddFacturXXml() no longer registers a validator.

For validation-enabled applications, reference VeritasData.Net.FacturX.Xml.Validation and use this registration instead. It also registers the core XML services:

using VeritasData.Net.FacturX.Xml;
using VeritasData.Net.FacturX.Xml.DependencyInjection;

services.AddFacturXValidation(new FacturXXmlOptions
{
    MaxCharactersInDocument = 16_777_216,
    MaxValidationIssues = 1_000,
    Indent = true
});

This additionally makes IFacturXValidator available. Repeated registration does not duplicate defaults or replace application-provided implementations. Both registrations preserve existing core services and options, so the first registered processing policy wins. The libraries depend only on the container abstractions; a host or application that builds a container must supply its container implementation.

Serialization

using VeritasData.Net.FacturX.Xml.Serialization;

var serializer = new FacturXSerializer();
using var source = File.OpenRead("incoming-invoice.xml");
var invoice = serializer.Deserialize(source);

/* Write values exactly as supplied; serialization never recalculates totals. */
using var destination = File.Create("outgoing-invoice.xml");
serializer.Serialize(invoice, destination);

All caller-supplied streams remain open on success and failure. Input streams do not need to be seekable. XML encoding detection is performed by XmlReader; output is UTF-8 with a declaration and without a byte-order mark. Decimal values are independent of the current culture.

Unknown elements and attributes are rejected rather than silently discarded. Unknown extensions are not preserved. Namespace prefixes, formatting, comments, and processing instructions are not preserved. Reading and writing alone does not validate profile conformance. The mutable model belongs to the caller; do not modify an invoice concurrently while a service is processing it.

Validation

Reference the optional VeritasData.Net.FacturX.Xml.Validation project or package. It owns the validator, diagnostic types, and embedded official standard resources; those types retain their existing namespace:

using VeritasData.Net.FacturX.Xml.Validation;

var validator = new FacturXValidator();
using var source = File.OpenRead("incoming-invoice.xml");
var result = validator.Validate(source);

/* Inspect the complete decision, not just the absence of one particular rule. */
if (!result.IsValid)
{
    foreach (var issue in result.Issues)
    {
        Console.WriteLine($"{issue.Stage}: {issue.RuleId}: {issue.Message}");
    }
}

The service also accepts XML strings and typed CrossIndustryInvoiceType instances. Validate original XML when checking the original document's schema conformance; typed validation checks its serialized representation.

ValidationResult contains read-only diagnostics, separate schema and business-rule completion flags, and a truncation flag. IsValid requires both stages to complete with no errors and no omitted diagnostics. Warnings and informational reports do not by themselves invalidate a completed result.

Malformed XML, prohibited DTDs, oversize input, schema failures, and unsupported profiles produce invalid results. Business rules are not run on schema-invalid documents. Infrastructure failures raise FacturXValidationException instead of pretending validation succeeded. SVRL business-rule IDs and XPath locations are retained; schema diagnostics include line information when available. Diagnostic messages may contain invoice values, so treat them as sensitive data.

The default input limit is 16,777,216 characters, not bytes. Diagnostic reporting is capped at 1,000 entries. These are not CPU-time or output-tree memory quotas. Validation is synchronous CPU work; bound application concurrency for untrusted workloads. The first call compiles the embedded rules once.

Decimal Calculations

using VeritasData.Net.FacturX.Xml.Calculations;

var calculator = new FacturXAmountCalculator();
var net = calculator.CalculateLineNetAmount(2m, 50m);
var vat = calculator.CalculateVatAmount(net, 19m);

The line equation is quantity times net price divided by price base quantity, plus line charges minus line allowances. Helpers round the completed equation to two decimal places. Their default midpoint policy is AwayFromZero, and callers can select a different policy explicitly. Negative quantities and tax bases are supported; negative unit prices, VAT rates, charges, and allowances, or nonpositive price base quantities are rejected. Decimal overflow is reported, not silently clamped.

These helpers are optional and never run implicitly. VAT grouping, exemptions, currency conversion, country-specific rounding, and document-level total assembly remain explicit application decisions checked by the official rules.

Runnable Creation Example

The example constructs a new typed invoice without loading a fixture, validates it against the official artifacts, writes UTF-8 XML, and reads it back.

dotnet run --project examples/VeritasData.Net.FacturX.Xml.Example --configuration Release -- ./example-invoice.xml

The chosen output file must not already exist. Party information is demonstration data and must not be used as real invoice data.

Standards Provenance

Technical artifacts and eight XML examples come directly from FNFE-MPE's official France_RFE repository at immutable commit 97ba0f3d4ef2abed5780e9490d5c3a2be832ab1d. Every imported file has a recorded SHA-256 hash. Tests verify the embedded technical bytes against that manifest. Only the base EN16931 rules are selected; French national overlays are excluded.

Model regeneration requires the pinned local tool. It adds XML descriptions to temporary schema copies only and reapplies the Veritas Data source header.

dotnet tool restore
./tools/Generate-Models.ps1

tools/Import-Standard.ps1 reimports the pinned upstream files when explicitly run. Normal builds and validation do not download standard resources. Generation scripts support Windows PowerShell 5.1 and PowerShell 7; build and tests require only the .NET SDK and restored NuGet dependencies.

Limitations and Licensing

This initial release is not a native-AOT or aggressive-trimming implementation. XML binding generation and complete official rules provide a conformance baseline, not third-party certification. Full production acceptance should include representative invoices from the intended trading partners.

Authored source retains the supplied VERITAS DATA GmbH copyright notice. Technical artifacts retain Apache 2.0 notices, SaxonCS-HE retains MPL 2.0 terms, and other dependencies retain their own licenses. See LICENSE.txt and THIRD-PARTY-NOTICES.md; no open-source license is implicitly granted for the authored library.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 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. 
.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 (1)

Showing the top 1 NuGet packages that depend on VeritasData.Net.FacturX.Xml:

Package Downloads
VeritasData.Net.FacturX.Xml.Validation

Stateless offline XSD and Schematron validation for Factur-X and ZUGFeRD EN16931 invoices.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-rc.7 59 11/13/2026
1.0.0-rc.6 61 11/13/2026

EN16931 XML model, strict serialization, DI registration, and decimal calculation helpers. Offline validation is available in VeritasData.Net.FacturX.Xml.Validation.