Documentation

How to read, stream and write DATEX II v3 road traffic data in Rust with the datex2 crate, in XML and JSON: the typed model, tolerance and warnings, the strict writers, the Mobilithek profile, limits and tested feeds.

datex2 is a Rust crate for DATEX II, the European standard for exchanging road traffic and travel information. It turns DATEX II version 3, XML or JSON, into typed Rust data and back.

Where to start

If you want toRead
Get data out of a file in five minutesGetting started
Understand what DATEX II is and how its documents are builtDATEX II in ten minutes
Read a whole documentReading
Process a feed of hundreds of megabytesStreaming
Publish a valid documentWriting
Read or write JSON, or publish for the MobilithekJSON and the Mobilithek
Find a type or a fieldThe typed model

What to expect

TopicRead
What the reader accepts from real feeds and how it tells youTolerance and warnings
What an error looks like and when a read failsErrors
Why it is safe to point at feeds you do not controlUntrusted input
Which national feeds it was tested on, and the known limitsTested feeds and limits
Speed, memory and build timeMeasurements

Scope

The crate handles DATEX II version 3: all 19 payload namespaces of release 3.7, read from documents of any 3.x release, in XML and in JSON (the 3.7 mapping and the Mobilithek's AFIR Recharging profile). It does not handle DATEX II version 1 or 2, or any network transport. See the FAQ for the reasons and the plans.

The crate is unofficial: it is not affiliated with or endorsed by the DATEX II organisation.