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 to | Read |
|---|---|
| Get data out of a file in five minutes | Getting started |
| Understand what DATEX II is and how its documents are built | DATEX II in ten minutes |
| Read a whole document | Reading |
| Process a feed of hundreds of megabytes | Streaming |
| Publish a valid document | Writing |
| Read or write JSON, or publish for the Mobilithek | JSON and the Mobilithek |
| Find a type or a field | The typed model |
What to expect
| Topic | Read |
|---|---|
| What the reader accepts from real feeds and how it tells you | Tolerance and warnings |
| What an error looks like and when a read fails | Errors |
| Why it is safe to point at feeds you do not control | Untrusted input |
| Which national feeds it was tested on, and the known limits | Tested feeds and limits |
| Speed, memory and build time | Measurements |
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.