1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//! An unofficial Rust implementation of [DATEX II](https://datex2.eu/), the European standard for
//! road traffic and travel information.
//!
//! This release reads DATEX II **version 3**, in XML and in JSON, into typed data, and writes it.
//! To read, one call is enough:
//!
//! ```
//! let xml = br#"<d2:payload xmlns:d2="http://datex2.eu/schema/3/d2Payload"
//! xmlns:com="http://datex2.eu/schema/3/common" xmlns:sit="http://datex2.eu/schema/3/situation"
//! xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
//! xsi:type="sit:SituationPublication" lang="en" modelBaseVersion="3">
//! <com:publicationTime>2026-11-19T12:00:00Z</com:publicationTime>
//! <com:publicationCreator>
//! <com:country>NL</com:country>
//! <com:nationalIdentifier>EXAMPLE</com:nationalIdentifier>
//! </com:publicationCreator>
//! </d2:payload>"#;
//!
//! let doc = datex2::v3::read(&xml[..])?;
//! for publication in &doc.publications {
//! println!("published at {:?}", publication.publication_time());
//! if let datex2::v3::Publication::Situation(p) = publication {
//! println!("{} situations", p.situation.len());
//! }
//! }
//! # Ok::<(), datex2::Error>(())
//! ```
//!
//! # What the reader does for you
//!
//! - **No setup.** The envelope (`payload`, `messageContainer`, a bare publication, SOAP around any
//! of them), namespace prefixes and the publication type are detected.
//! - **Tolerant, and it tells you.** Real feeds deviate from the standard. The reader accepts the
//! deviations it knows and lists each one in [`v3::Document::warnings`]. Nothing is dropped
//! silently and no value is invented.
//! - **Errors you can act on.** An [`Error`] names the element path, the byte offset, what was
//! expected and what was found.
//! - **Safe on untrusted input.** [`Limits`] bound nesting, attributes and text; document type
//! declarations are refused. The [threat model](threat_model) lists what is defended against
//! and what is not.
//!
//! # Large files
//!
//! [`v3::stream`] delivers the records of a document one at a time and keeps only one in memory.
//!
//! # Writing
//!
//! [`v3::write`] turns a publication into a document the official schema accepts, or says which
//! rule of the schema the publication breaks.
//!
//! # JSON and the Mobilithek
//!
//! [`v3::json`] reads and writes the same model as JSON: the official DATEX II 3.7 mapping, and
//! the German AFIR Recharging profile the Mobilithek requires
//! ([`v3::json::mobilithek`]). Numbers keep their exact value; the crate has no JSON dependency.
//!
//! # What it does not do
//!
//! DATEX II versions 1 and 2, and any network or file access. The crate reads the bytes you give
//! it and writes to the sink you give it.
//!
//! This crate is not affiliated with or endorsed by the DATEX II organisation.
pub use ;
pub use ;
pub use Limits;
/// The examples in the README and on the documentation site are compiled, and where they can
/// be, run, with the documentation tests.