Strongly-typed C# XML bindings for Transmodel-based European public transport standards. Currently, covers NeTEx (Network Timetable Exchange) and SIRI (Service Interface for Real-time Information), with the flexibility to support additional Transmodel-based standards.
Generated from the official CEN XSD schemas and verified with automated tests.
Note: This project was developed with significant AI assistance. While it is functional and tested, it has not yet undergone a full manual review. Treat it as pre-production. Cntributions and feedback are welcome.
A CLI tool that downloads XSD schemas from the official CEN repositories and generates modern C# XML bindings with the latest features. Use it to generate bindings for any schema version, including unreleased branches or specific commits.
| Package | NuGet |
|---|---|
Spillgebees.Transmodel.Generator |
dotnet tool install -g Spillgebees.Transmodel.Generatortransmodel-generator generate-netex --version v1.3.1 --output ./Generated --namespace MyApp.NeTExGenerates XML bindings with the following sub-namespaces:
| Sub-namespace | XML Namespace | Description |
|---|---|---|
MyApp.NeTEx.NeTEx |
http://www.netex.org.uk/netex |
NeTEx types |
MyApp.NeTEx.SIRI |
http://www.siri.org.uk/siri |
SIRI types (subset bundled with NeTEx) |
MyApp.NeTEx.GML |
http://www.opengis.net/gml/3.2 |
GML types (geographic markup) |
transmodel-generator generate-siri --version v2.2 --output ./Generated --namespace MyApp.SIRIGenerates XML bindings with the following sub-namespaces:
| Sub-namespace | XML Namespace | Description |
|---|---|---|
MyApp.SIRI.SIRI |
http://www.siri.org.uk/siri |
Core SIRI types |
MyApp.SIRI.IFOPT |
http://www.ifopt.org.uk/ifopt |
IFOPT types |
MyApp.SIRI.ACSB |
http://www.ifopt.org.uk/acsb |
Accessibility types |
MyApp.SIRI.DATEX2 |
http://datex2.eu/schema/2_0RC1/2_0 |
DATEX2 types |
MyApp.SIRI.WSDL |
http://wsdl.siri.org.uk |
WSDL/SOAP types |
MyApp.SIRI.GML |
http://www.opengis.net/gml/3.2 |
GML types (geographic markup) |
MyApp.SIRI.W3 |
http://www.w3.org/XML/1998/namespace |
W3 types |
transmodel-generator generate-netex [options]
transmodel-generator generate-siri [options]
Options:
-v, --version <version> Schema version tag (default: v1.3.1 for NeTEx, v2.2 for SIRI)
--ref <ref> Git ref (branch or commit SHA), mutually exclusive with --version
-o, --output <output> Output directory for generated C# files (default: ./Generated)
-n, --namespace <namespace> Root C# namespace (default: NeTEx.Models / SIRI.Models)
--clean Delete output directory before generating
--verbose Enable verbose logging
transmodel-generator list-netex-versions List available NeTEx version tags
transmodel-generator list-siri-versions List available SIRI version tags
If you don't need custom generation, install one of the pre-generated packages below. These are built with the same generator, tested, and published to NuGet for every release.
Versions correspond to tags in the NeTEx-CEN/NeTEx GitHub repository.
| NeTEx version | Package | NuGet |
|---|---|---|
| v1.2 | Spillgebees.NeTEx.Models.V1_2 |
|
| v1.2.2 | Spillgebees.NeTEx.Models.V1_2_2 |
|
| v1.2.3 | Spillgebees.NeTEx.Models.V1_2_3 |
|
| v1.3.0 | Spillgebees.NeTEx.Models.V1_3_0 |
|
| v1.3.1 | Spillgebees.NeTEx.Models.V1_3_1 |
|
| All versions | Spillgebees.NeTEx.Models |
dotnet add package Spillgebees.NeTEx.Models.V1_3_1Each NeTEx version package contains three sub-namespaces:
| Sub-namespace | XML Namespace | Description |
|---|---|---|
.NeTEx |
http://www.netex.org.uk/netex |
NeTEx types |
.SIRI |
http://www.siri.org.uk/siri |
SIRI types (subset bundled with NeTEx) |
.GML |
http://www.opengis.net/gml/3.2 |
GML types (geographic markup) |
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using Spillgebees.NeTEx.Models.V1_3_1.NeTEx;
var delivery = new PublicationDeliveryStructure
{
PublicationTimestamp = DateTimeOffset.UtcNow,
ParticipantRef = "my-data-provider",
Description = new MultilingualString { Value = "Stop places export" },
};
var serializer = new XmlSerializer(typeof(PublicationDeliveryStructure));
using var stream = new MemoryStream();
using var xmlWriter = XmlWriter.Create(stream, new XmlWriterSettings
{
Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false),
Indent = true,
});
serializer.Serialize(xmlWriter, delivery);
// <?xml version="1.0" encoding="utf-8"?>
// <PublicationDelivery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...>
// <PublicationTimestamp>2026-02-13T12:00:00+00:00</PublicationTimestamp>
// <ParticipantRef>my-data-provider</ParticipantRef>
// <Description>Stop places export</Description>
// </PublicationDelivery>Versions correspond to tags in the SIRI-CEN/SIRI GitHub repository.
| SIRI version | Package | NuGet |
|---|---|---|
| v2.1 | Spillgebees.SIRI.Models.V2_1 |
|
| v2.2 | Spillgebees.SIRI.Models.V2_2 |
|
| All versions | Spillgebees.SIRI.Models |
dotnet add package Spillgebees.SIRI.Models.V2_2Each SIRI version package contains seven sub-namespaces:
| Sub-namespace | XML Namespace | Description |
|---|---|---|
.SIRI |
http://www.siri.org.uk/siri |
SIRI types |
.IFOPT |
http://www.ifopt.org.uk/ifopt |
IFOPT types |
.ACSB |
http://www.ifopt.org.uk/acsb |
Accessibility types |
.DATEX2 |
http://datex2.eu/schema/2_0RC1/2_0 |
DATEX2 types |
.WSDL |
http://wsdl.siri.org.uk |
WSDL/SOAP types |
.GML |
http://www.opengis.net/gml/3.2 |
GML types (geographic markup) |
.W3 |
http://www.w3.org/XML/1998/namespace |
W3 types |
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using Spillgebees.SIRI.Models.V2_2.SIRI;
var siri = new Siri
{
ServiceDelivery = new ServiceDelivery
{
ResponseTimestamp = DateTimeOffset.UtcNow,
},
};
var serializer = new XmlSerializer(typeof(Siri));
using var stream = new MemoryStream();
using var xmlWriter = XmlWriter.Create(stream, new XmlWriterSettings
{
Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false),
Indent = true,
});
serializer.Serialize(xmlWriter, siri);
// <?xml version="1.0" encoding="utf-8"?>
// <Siri xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...>
// <ServiceDelivery>
// <ResponseTimestamp>2026-02-13T12:00:00+00:00</ResponseTimestamp>
// </ServiceDelivery>
// </Siri>The generated bindings are not committed to the repository, they are generated at build time. To build locally:
dotnet build Spillgebees.Transmodel.slnx --configuration Release
dotnet test --solution Spillgebees.Transmodel.slnx --configuration ReleaseThe build downloads the XSD schemas from GitHub, generates the XML bindings, and compiles them. Downloaded schemas are cached in local app data so subsequent builds don't require network access.
Use dotnet clean to remove the generated files and trigger a fresh generation on the next build.
- .NET 10.0
This project is licensed under the European Union Public Licence v. 1.2 (EUPL-1.2).
The NeTEx schemas are licensed under GPL-3.0 by CEN. EUPL-1.2 is compatible with GPL-3.0 per its compatibility clause. The SIRI schemas are published by CEN on the SIRI-CEN/SIRI repository without an explicit open-source license.