Skip to main content

Crate jubarte_dom

Crate jubarte_dom 

Source
Expand description

§jubarte-dom

The document-object-model floor of the jubarte redline engine: the arena XML DOM (xmllinq), WordprocessingML namespace and XName constants (namespaces), short ids and unique ids (ids, unid), the compiled-out performance counters (perf), shared small utilities (util), and the OOXML vocabulary notes and input limits the layers above share (ooxml, limits).

Nothing here knows Word documents as packages; the OPC adapter and every product above it live in higher jubarte crates and reach this one downward only.

§Example

use jubarte_dom::namespaces::W;
use jubarte_dom::xmllinq::Dom;

let mut dom = Dom::new();
let doc = dom.parse_xdocument(concat!(
    r#"<w:p xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">"#,
    "<w:r><w:t>Hello</w:t></w:r><w:r><w:t>, world</w:t></w:r></w:p>",
));
let paragraph = dom.root(doc).expect("one root element");
assert_eq!(dom.elements(paragraph, Some(&W::r())).len(), 2);
assert_eq!(dom.value(paragraph), "Hello, world");
println!("{}", dom.serialize_document(doc));

Modules§

ids
The one grammar of the ids jubarte prints and reads: ShortId (src/ids/short.rs, spec 2026-10-13 §2 and §2.1). The functions here are the options’ views of it: a change (r12, r1+2, header1.r1), a comment (c27), the text a comment covers (c27.text), and what -p takes (a paragraph p12, a story header1 or its paragraph header1.p2, a cell t0.row1.cell2[.p1], a comment, or changes).
namespaces
WordprocessingML and related namespace / XName constants. WordprocessingML and related namespace / XName constants ported from PtOpenXmlUtil.ts (the subset the comparer references) — M1.7.
perf
P0-LAB-01 stage counters/timers — no-ops unless perf-profile is enabled. P0-LAB-01 — feature-gated stage counters and coarse timers.
unid
Port of UnidHelper (UnidHelper.ts) — M1.7.
util
Shared small utilities. Small shared utilities, ported from PtUtil.ts (M1.6).
xmllinq
Arena DOM (xmllinq) used by the comparer. LINQ-to-XML-style mutable XML tree, ported from lib/xml-linq.ts.