Skip to content

Getting started ​

Choose the public surface ​

SurfaceStable nameOwner
Canonical Cargo packageopenbim-idmAll Rust implementation, types, CLI, and PyO3 behavior
Rust compatibility aliasidmxmlA single exact-version re-export statement
Rust binaryidmxmlBuilt by openbim-idm with the cli feature
Python packageidmxmlThin Python ergonomics over idmxml._native
Python CLIidmpyPython 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 ​

bash
cargo test --workspace --all-features
cargo run -p openbim-idm --bin idmxml -- \
  inspect openbim-idm/tests/fixtures/recursive-extension.xml --json
rust
use 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 ​

bash
uv sync --extra test
uv run maturin develop --features python
uv run pytest
python
from 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.

Next: formal schema validation without bundled schemas.

Implementation dual-licensed AGPL-3.0-or-later OR LicenseRef-Commercial. Standards material is not redistributed.