openehr-its 0.0.2

openEHR ITS (Implementation Technology Specifications): canonical JSON + XML serialization, ITS-REST OpenAPI contract, ITS-BMM. Mirrors the specifications-ITS-{JSON,XML,REST,BMM} repos.
Documentation
// @generated by openehr-codegen (emit-aom2) — DO NOT EDIT.
//! openEHR AOM2 persistent-form archetype model + canonical-XML codec.
//!
//! Parse a persistent-form AOM2 archetype with [`from_xml`]; the root element is `<archetype>` (`P_AUTHORED_ARCHETYPE`).
//!
//! This is the PERSISTENT (`P_AOM`) AOM2 serialization — `P_Archetype.xsd`, whose
//! own header calls it "uses P_AOM types - much more space efficient". It is the
//! form the bundle's 8 `AOM2/examples/*.xml` documents carry
//! (`xsi:schemaLocation="… ../P_Archetype.xsd"`). The bundle's other archetype
//! serialization — the AOM model form — is [`crate::aom2_model`].

mod impls;
mod types;
pub use types::*;

/// Parse a persistent-form AOM2 archetype XML document into a [`PAuthoredArchetype`].
///
/// # Errors
/// Propagates canonical-XML parse errors.
pub fn from_xml(xml: &str) -> Result<PAuthoredArchetype, crate::xml::runtime::XmlError> {
    crate::xml::runtime::from_xml(xml)
}

/// Serialize a [`PAuthoredArchetype`] back to AOM2 persistent-form archetype XML (root `<archetype>`,
/// `http://schemas.openehr.org/v1`).
///
/// # Errors
/// Propagates canonical-XML serialization errors.
pub fn to_xml(value: &PAuthoredArchetype) -> Result<String, crate::xml::runtime::XmlError> {
    crate::xml::runtime::to_xml(value, "archetype", crate::xml::runtime::Namespace::V1)
}