Skip to main content

jubarte_dom/
lib.rs

1// SPDX-FileCopyrightText: 2026 Jandira Technologies, LLC
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! # jubarte-dom
6//!
7//! The document-object-model floor of the jubarte redline engine: the
8//! arena XML DOM (`xmllinq`), WordprocessingML namespace and `XName`
9//! constants (`namespaces`), short ids and unique ids (`ids`, `unid`),
10//! the compiled-out performance counters (`perf`), shared small utilities
11//! (`util`), and the OOXML vocabulary notes and input limits the layers
12//! above share (`ooxml`, `limits`).
13//!
14//! Nothing here knows Word documents as packages; the OPC adapter and
15//! every product above it live in higher jubarte crates and reach this
16//! one downward only.
17//!
18//! # Example
19//!
20//! ```rust
21//! use jubarte_dom::namespaces::W;
22//! use jubarte_dom::xmllinq::Dom;
23//!
24//! let mut dom = Dom::new();
25//! let doc = dom.parse_xdocument(concat!(
26//!     r#"<w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">"#,
27//!     "<w:r><w:t>Hello</w:t></w:r><w:r><w:t>, world</w:t></w:r></w:p>",
28//! ));
29//! let paragraph = dom.root(doc).expect("one root element");
30//! assert_eq!(dom.elements(paragraph, Some(&W::r())).len(), 2);
31//! assert_eq!(dom.value(paragraph), "Hello, world");
32//! println!("{}", dom.serialize_document(doc));
33//! ```
34
35#![cfg_attr(all(coverage_nightly, test), feature(coverage_attribute))]
36#![forbid(unsafe_code)]
37#![warn(missing_docs)]
38
39pub mod ids;
40/// Bound untrusted input before it is opened. Private in the facade; the
41/// `jubarte-opc` crate consumes it (`jubarte::admission` re-exports the
42/// limits types).
43// TODO(split): `#[doc(hidden)]` once jubarte-opc exists to name it (A5 V2).
44#[doc(hidden)]
45pub mod limits;
46/// WordprocessingML and related namespace / `XName` constants.
47pub mod namespaces;
48/// OOXML vocabulary facts shared by the layers above. Private in the
49/// facade (`jubarte::opc` and friends hold their own).
50#[doc(hidden)]
51pub mod ooxml;
52/// P0-LAB-01 stage counters/timers — no-ops unless `perf-profile` is
53/// enabled.
54pub mod perf;
55pub mod unid;
56/// Shared small utilities.
57pub mod util;
58/// Arena DOM (`xmllinq`) used by the comparer.
59pub mod xmllinq;