Production-ready polyglot transit data bridge demonstrating PolyXML compiling European CEN SIRI v2.0 (EN 15531) & NeTEx (CEN/TS 16614) XML schemas and bridging live Google GTFS-Realtime (Protobuf/JSON) telemetry across all 7 supported programming languages: Rust, Python, Go, C++20, Java 21+, TypeScript 5+, and C# 12 / .NET 8.
Modern public transportation and urban mobility systems are globally divided into two major standardizations:
-
Google GTFS-Realtime (Protobuf / JSON):
- Developed by Google and transit developers worldwide.
- De facto standard for consumer passenger apps (Google Maps, Apple Maps, Transit App, Citymapper).
- Lightweight, binary-first protobuf telemetry focused on live vehicle coordinates, delays, and trip cancellations.
-
CEN SIRI & NeTEx (European Norm XML Standard):
- SIRI (Service Interface for Real Time Information - EN 15531) & NeTEx (Network Timetable Exchange - CEN/TS 16614).
- Statutory European Commission mandate for multi-modal cross-border transit data exchange (e.g. Dutch NDOV Loket / BISON, UK Bus Open Data Service, German VDV 453/454, French IDFM).
- Rich, deeply hierarchical XML schemas representing monitored vehicle journeys, stop calls, headway progress, and occupancy.
Historically, bridging GTFS-RT and CEN SIRI required maintaining separate hand-crafted XML parsers and JSON encoders in every programming language. PolyXML completely eliminates this impedance mismatch by providing:
- Unified Typed Data Models: Single schema source (
siri_core.xsd) compiled into idiomatic, native types in 7 languages. - Inherent Dual XML & JSON Serialization: The same memory structure serializes to both validated CEN SIRI XML and clean JSON with zero boilerplate.
- Sub-Millisecond Polyglot Performance: Zero-copy parsing in Rust, header-only value types in C++20, records in Java 21 & C#, and C-speed transcoding in Python and TypeScript.
sequenceDiagram
autonumber
participant GVB as Amsterdam GVB Tram 4<br/>(Telemetry Feed)
participant GTFS as Google GTFS-RT<br/>(Protobuf / JSON)
participant PolyXML as PolyXML Bridge<br/>(Rust | Python | Go | C++ | Java | TS | C#)
participant NDOV as Dutch NDOV Loket / EU SIRI<br/>(CEN SIRI v2.0 XML)
participant API as Transit Microservices<br/>(Inherent JSON)
GVB->>GTFS: Live GPS Telemetry (NL_ARR_GVB_TRAM_4_2042)
GTFS->>PolyXML: Ingest VehiclePosition & TripDescriptor
Note over PolyXML: Strongly-Typed Mapping to SIRI Model<br/>(MonitoredVehicleJourney, Location, Occupancy)
par European Standard Broadcast
PolyXML->>NDOV: Stream CEN SIRI XML (<Siri version="2.0">...)
and Modern Cloud APIs
PolyXML->>API: Stream Inherent JSON ({"ServiceDelivery": ...})
end
API->>PolyXML: JSON Query / Roundtrip Deserialization
Note over PolyXML: Inherent roundtrip restoration with 100% field parity
All 7 implementations were benchmarked ingesting live Amsterdam GVB Tram 4 telemetry (data/gtfs_realtime_vehicle.json), transforming it into a CEN SIRI vehicle monitoring payload, serializing to XML, and serializing to JSON on the same model.
| Target Language | PolyXML Paradigm | Cold XML Latency | JSON Latency | Steady-State (JIT Warmed) | Runtime Schema Validation |
|---|---|---|---|---|---|
| π¦ Rust | Borrowed zero-copy slices (Cow<'a, str>) & quick-xml codecs |
79.4 ΞΌs | 107.3 ΞΌs | ~79 ΞΌs (AOT native) | Native facet checks |
| β‘ C++20 | Header-only value types, XmlModel concepts & operator== |
106.4 ΞΌs | 6.2 ΞΌs | ~106 ΞΌs (AOT native) | Static concept verification |
| πΉ Go | Dual xml:"..." and json:"..." struct tags + XMLName |
105.2 ΞΌs | 174.9 ΞΌs | ~105 ΞΌs (AOT native) | .Validate() methods |
| π TypeScript 5+ | Native ES interfaces + runtime Zod object schemas | 191.4 ΞΌs | 25.1 ΞΌs | ~2.1 ΞΌs (V8 TurboFan) | Zod schema parse (SiriTypeSchema) |
| β Java 21+ | Immutable records, java.time.Instant, sealed interfaces |
3.0 ms (cold) | 583.7 ΞΌs | ~8.3 ΞΌs (HotSpot C2 JIT) | Immutability & nullability checks |
| π Python | @dataclass(slots=True) + PolyXML C-Engine bindings |
3.7 ms | 439.7 ΞΌs | ~3.7 ms (Interpreted) | Inherent dataclass validation |
| π· C# 12 / .NET 8 | Primary constructor records, XmlSerializer + System.Text.Json |
57.7 ms (cold) | 39.4 ms | ~28.5 ΞΌs (RyuJIT) | IValidatableObject |
Benchmarked on Linux x86_64 across identical Amsterdam GVB Tram 4 telemetry payloads.
Note
Understanding Cold Single-Shot vs. Steady-State (JIT Warmed) Latency:
- AOT Compiled Languages (Rust, C++, Go): Compiled Ahead-of-Time directly to native machine code. They have zero classloading or JIT warm-up overhead; execution immediately runs at full production speed on the very first instruction.
- Managed JIT Runtimes (Java 21+, C# 12 / .NET 8): Single-shot cold measurements include one-time JVM dynamic class loading, bytecode verification, and .NET
XmlSerializercode generation (~3β57 ms). In continuous production environments (e.g., real-time transit dispatchers, broker microservices, Kafka/streaming consumers) after HotSpot C2 / RyuJIT compilation, Java executes in ~8.3 ΞΌs and C# in ~28.5 ΞΌs.
You can regenerate the entire typed polyglot codebase directly from the CEN SIRI XML Schema using the PolyXML CLI.
polyxml buildpolyxml generate schemas/transit/siri_core.xsd \
--lang rust \
--zero-copy \
--codecs \
--out generated/rustpolyxml generate schemas/transit/siri_core.xsd \
--lang python \
--backend dataclass \
--codecs \
--out generated/pythonpolyxml generate schemas/transit/siri_core.xsd \
--lang go \
--package siri \
--out generated/gopolyxml generate schemas/transit/siri_core.xsd \
--lang cpp \
--package "polyxml::generated" \
--out generated/cpppolyxml generate schemas/transit/siri_core.xsd \
--lang java \
--package "com.transit.siri" \
--out generated/javapolyxml generate schemas/transit/siri_core.xsd \
--lang ts \
--zod \
--out generated/typescriptpolyxml generate schemas/transit/siri_core.xsd \
--lang csharp \
--package "Transit.Siri" \
--out generated/csharpPolyXML generated models do not require converting XML to an intermediate dictionary to get JSON. The exact same typed memory structure serializes cleanly to both CEN SIRI XML and JSON.
<Siri xmlns="http://www.siri.org.uk/siri" version="2.0">
<ServiceDelivery>
<ResponseTimestamp>2026-09-20T14:00:00Z</ResponseTimestamp>
<ProducerRef>NDOV_LOKET_NL</ProducerRef>
<VehicleMonitoringDelivery>
<ResponseTimestamp>2026-09-20T14:00:00Z</ResponseTimestamp>
<VehicleActivity>
<RecordedAtTime>2026-09-20T14:00:00Z</RecordedAtTime>
<ValidUntilTime>2026-09-20T14:05:00Z</ValidUntilTime>
<VehicleMonitoringRef>NL_ARR_GVB_TRAM_4_2042</VehicleMonitoringRef>
<MonitoredVehicleJourney>
<LineRef>LINE_4</LineRef>
<DirectionRef>0</DirectionRef>
<FramedVehicleJourneyRef>
<DataFrameRef>2026-09-20</DataFrameRef>
<DatedVehicleJourneyRef>TRIP_NL_GVB_4_1042</DatedVehicleJourneyRef>
</FramedVehicleJourneyRef>
<PublishedLineName>Tram 4 - Centraal Station</PublishedLineName>
<OperatorRef>GVB_AMSTERDAM</OperatorRef>
<OriginRef>NL:S:30000099</OriginRef>
<DestinationRef>NL:S:30000001</DestinationRef>
<DestinationName>Amsterdam Centraal Station</DestinationName>
<VehicleLocation>
<Longitude>4.8952</Longitude>
<Latitude>52.3702</Latitude>
<Altitude>2.5</Altitude>
</VehicleLocation>
<Bearing>142.5</Bearing>
<ProgressRate>normalProgress</ProgressRate>
<Occupancy>manySeatsAvailable</Occupancy>
<Delay>PT0S</Delay>
<VehicleRef>GVB_TRAM_2042</VehicleRef>
<MonitoredCall>
<StopPointRef>NL:S:30000001</StopPointRef>
<VisitNumber>7</VisitNumber>
<StopPointName>Centraal Station</StopPointName>
<VehicleAtStop>false</VehicleAtStop>
<AimedArrivalTime>2026-09-20T14:02:30Z</AimedArrivalTime>
<ExpectedArrivalTime>2026-09-20T14:02:30Z</ExpectedArrivalTime>
</MonitoredCall>
</MonitoredVehicleJourney>
</VehicleActivity>
</VehicleMonitoringDelivery>
</ServiceDelivery>
</Siri>{
"version": "2.0",
"ServiceDelivery": {
"ResponseTimestamp": "2026-09-20T14:00:00Z",
"ProducerRef": "NDOV_LOKET_NL",
"VehicleMonitoringDelivery": {
"ResponseTimestamp": "2026-09-20T14:00:00Z",
"VehicleActivity": [
{
"RecordedAtTime": "2026-09-20T14:00:00Z",
"ValidUntilTime": "2026-09-20T14:05:00Z",
"VehicleMonitoringRef": "NL_ARR_GVB_TRAM_4_2042",
"MonitoredVehicleJourney": {
"LineRef": "LINE_4",
"DirectionRef": "0",
"FramedVehicleJourneyRef": {
"DataFrameRef": "2026-09-20",
"DatedVehicleJourneyRef": "TRIP_NL_GVB_4_1042"
},
"PublishedLineName": "Tram 4 - Centraal Station",
"OperatorRef": "GVB_AMSTERDAM",
"OriginRef": "NL:S:30000099",
"DestinationRef": "NL:S:30000001",
"DestinationName": "Amsterdam Centraal Station",
"VehicleLocation": {
"Longitude": 4.8952,
"Latitude": 52.3702,
"Altitude": 2.5
},
"Bearing": 142.5,
"ProgressRate": "normalProgress",
"Occupancy": "manySeatsAvailable",
"Delay": "PT0S",
"VehicleRef": "GVB_TRAM_2042",
"MonitoredCall": {
"StopPointRef": "NL:S:30000001",
"VisitNumber": 7,
"StopPointName": "Centraal Station",
"VehicleAtStop": false,
"AimedArrivalTime": "2026-09-20T14:02:30Z",
"ExpectedArrivalTime": "2026-09-20T14:02:30Z"
}
}
}
]
}
}
}| Google GTFS-Realtime (Protobuf / JSON) | CEN SIRI v2.0 (XML) | SIRI Semantic Context |
|---|---|---|
entity.id |
VehicleActivity/VehicleMonitoringRef |
Unique persistent journey monitoring identifier |
vehicle.trip.route_id |
MonitoredVehicleJourney/LineRef |
Public transit line designation (e.g. LINE_4) |
vehicle.trip.direction_id |
MonitoredVehicleJourney/DirectionRef |
Outbound (0) vs Inbound (1) routing |
vehicle.trip.trip_id |
FramedVehicleJourneyRef/DatedVehicleJourneyRef |
Scheduled timetable operating trip ID |
vehicle.vehicle.id |
MonitoredVehicleJourney/VehicleRef |
Physical vehicle unit number (e.g. GVB_TRAM_2042) |
vehicle.position.latitude |
VehicleLocation/Latitude |
WGS84 decimal latitude |
vehicle.position.longitude |
VehicleLocation/Longitude |
WGS84 decimal longitude |
vehicle.position.altitude |
VehicleLocation/Altitude |
Elevation in meters above sea level |
vehicle.position.bearing |
MonitoredVehicleJourney/Bearing |
Heading azimuth in degrees (0.0 - 360.0) |
vehicle.occupancy_status |
MonitoredVehicleJourney/Occupancy |
Passenger capacity indicator (e.g. manySeatsAvailable) |
vehicle.stop_id |
MonitoredCall/StopPointRef |
National stop point reference (e.g. NL:S:30000001) |
vehicle.current_stop_sequence |
MonitoredCall/VisitNumber |
Sequence index along the route profile |
vehicle.current_status |
MonitoredCall/VehicleAtStop |
STOPPED_AT (true) vs IN_TRANSIT_TO (false) |
- Git, Bash
- Rust 1.80+ (with Cargo)
- Go 1.22+
- Python 3.11+
- GCC / Clang (C++20 support) & CMake 3.20+
- JDK 21+ & Maven 3.9+
- Node.js 22+ (for
--experimental-strip-types) - .NET 8 SDK
Execute the automated test suite verifying 100% green execution across all languages:
git clone https://github.com/polyxml/polyxml-transit-examples.git
cd polyxml-transit-examples
# Execute the complete polyglot test suite & transcoder demo
./scripts/run_all.sh# π¦ Rust
cargo run --manifest-path examples/rust/Cargo.toml
# π Python
python3 examples/python/bridge.py
# πΉ Go
go run ./examples/go
# β‘ Modern C++20
cmake -B examples/cpp/build examples/cpp -DCMAKE_BUILD_TYPE=Release
cmake --build examples/cpp/build
./examples/cpp/build/gtfs_siri_bridge
# β Java 21+
mvn -f examples/java/pom.xml compile exec:java -q
# π TypeScript 5+
node --experimental-strip-types examples/typescript/index.ts
# π· C# 12 / .NET 8
dotnet run --project examples/csharp/GtfsSiriAdapter.csproj./scripts/run_transcode_demo.shpolyxml-transit-examples/
βββ schemas/
β βββ transit/siri_core.xsd # CEN SIRI v2.0 / NeTEx XML Schema definition
β βββ gtfs/gtfs-realtime.proto # Canonical Google GTFS-Realtime Protobuf definition
βββ data/
β βββ gtfs_realtime_vehicle.json # Live Amsterdam GVB Tram 4 telemetry payload
β βββ siri_vehicle_monitoring.xml # European CEN SIRI v2.0 XML delivery payload
βββ polyxml.toml # Multi-target compiler configuration
βββ generated/ # PolyXML-generated typed models
β βββ rust/siri_core.rs
β βββ python/siri_core.py
β βββ go/siri_core.go
β βββ cpp/siri_core.hpp
β βββ java/com/transit/siri/*.java
β βββ typescript/siri_core.ts
β βββ csharp/SiriCore.cs
βββ examples/ # Runnable implementations in all 7 languages
β βββ rust/ # Rust zero-copy adapter
β βββ python/ # Python dataclass + PolyXML C-engine adapter
β βββ go/ # Go dual XML/JSON struct tags
β βββ cpp/ # C++20 XmlModel value types
β βββ java/ # Java 21 records & Instant timestamps
β βββ typescript/ # TypeScript 5 + runtime Zod schemas
β βββ csharp/ # C# 12 / .NET 8 primary constructor records
βββ scripts/
β βββ generate_all.sh # CLI generation script with flags for all 7 languages
β βββ run_transcode_demo.sh # CLI streaming XML <-> JSON transcoding demo
β βββ run_all.sh # Complete test orchestrator across all targets
βββ .github/workflows/ci.yml # Matrix CI testing all 7 languages on GitHub
Distributed under the MIT License. See LICENSE for full terms.
For third-party standards, specifications, open transit licenses (Apache 2.0 for GTFS Realtime), and trademark notices, see NOTICE.
All schemas are sourced from open international standards bodies (Google GTFS-Realtime and CEN SIRI).