openbim_gaeb/lib.rs
1//! Pure-Rust, lossless tools for GAEB DA XML.
2//!
3//! `openbim-gaeb` recognizes GAEB by content, cross-checks namespace/header/DP
4//! evidence, extracts common bill-of-quantities item views, and preserves the
5//! complete source document. Unknown XML remains byte-identical. Supported edits
6//! splice only the requested field and then reparse atomically.
7//!
8//! # Boundary
9//!
10//! XML mechanics use `quick-xml` directly. BOM handling, content detection,
11//! streaming element interpretation, GAEB exchange phases,
12//! BoQ semantics, diagnostics, and editing remain here because they are GAEB
13//! policy rather than generic XML behavior.
14//!
15//! # Example
16//!
17//! ```
18//! use openbim_gaeb::{Document, ExchangePhase, GaebVersion};
19//!
20//! let xml = br#"<GAEB xmlns="http://www.gaeb.de/GAEB_DA_XML/DA83/3.3">
21//! <GAEBInfo><Version>3.3</Version><VersDate>2023-01</VersDate></GAEBInfo>
22//! <Award><DP>83</DP></Award>
23//! </GAEB>"#;
24//! let document = Document::parse(xml)?;
25//! assert_eq!(document.metadata().version, Some(GaebVersion::V3_3));
26//! assert_eq!(document.metadata().phase, Some(ExchangePhase::X83));
27//! assert_eq!(document.as_bytes(), xml);
28//! # Ok::<(), openbim_gaeb::Error>(())
29//! ```
30//!
31//! # Capability limits
32//!
33//! This is not an XSD validator and does not claim complete typed bindings for
34//! every phase. [`Item`] is a common read model; unsupported GAEB content remains
35//! accessible and preserved through [`Document::as_bytes`].
36
37#![forbid(unsafe_code)]
38
39mod diagnostic;
40mod document;
41mod error;
42mod metadata;
43mod model;
44mod parser;
45mod phase;
46mod version;
47
48pub use diagnostic::{Diagnostic, DiagnosticKind};
49pub use document::Document;
50pub use error::Error;
51pub use metadata::Metadata;
52pub use model::{CategoryRef, Item};
53pub use phase::ExchangePhase;
54pub use version::GaebVersion;