Getting started
Choose the public surface
| Surface | Stable name | Owner |
|---|---|---|
| Canonical Cargo package | openbim-idm | All Rust implementation, types, CLI, and PyO3 behavior |
| Rust compatibility alias | idmxml | A single exact-version re-export statement |
| Rust binary | idmxml | Built by openbim-idm with the cli feature |
| Python package | idmxml | Thin Python ergonomics over idmxml._native |
| Python CLI | idmpy | Python command facade |
The Rust crates are on crates.io (openbim-idm = "0.3", or the alias idmxml). The Python package is not yet on PyPI; for Python, clone the repository and build with maturin.
Rust
cargo test --workspace --all-features
cargo run -p openbim-idm --bin idmxml -- \
inspect openbim-idm/tests/fixtures/recursive-extension.xml --jsonuse openbim_idm::Document;
let document = Document::parse("<idm/>")?;
assert_eq!(document.root().local_name(), "idm");
# Ok::<(), openbim_idm::Error>(())The parser's default maximum input is 64 MiB and maximum nesting is 1,024 levels. Applications can lower the byte limit with Document::with_max_xml_bytes.
Python
uv sync --extra test
uv run maturin develop --features python
uv run pytestfrom pathlib import Path
import idmxml
document = idmxml.fileio.load(Path("model.idmxml"))
print(document.count("er"))
print(document.validate())What “lossless” means
The data model is the complete XML tree, not a narrowed business DTO. A parse/serialize cycle retains qualified names, namespace URIs and prefixes, unknown/vendor content, child and attribute ordering, comments, CDATA, and processing instructions. Pretty formatting may change whitespace; compact serialization and the tree JSON form make structural equality testable. Character and entity references are kept as their own nodes, and text set through the API is stored the same way, so an edited document equals the document read back from its serialization. Text that XML cannot carry (control characters, ]]> inside CDATA, -- inside comments) is rejected instead of being written as unreadable output. Element nesting is limited to DEFAULT_MAX_XML_DEPTH (256) for XML, JSON and edits alike.