Skip to main content

mx20022_parse/
lib.rs

1//! XML parsing and serialization for ISO 20022 messages.
2//!
3//! This crate wraps [`quick_xml`] with [`serde`] support into a convenient API
4//! for reading and writing ISO 20022 financial messages.
5//!
6//! # Quick start
7//!
8//! ```no_run
9//! use mx20022_parse::{de, ser, envelope};
10//! # use mx20022_model::generated::head::BusinessApplicationHeaderV04;
11//!
12//! // Detect message type from raw XML
13//! let raw = r#"<AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.04">...</AppHdr>"#;
14//! let msg_id = envelope::detect_message_type(raw).unwrap();
15//! assert_eq!(msg_id.family, "head");
16//!
17//! // Parse a known type
18//! // let hdr: BusinessApplicationHeaderV04 = de::from_str(raw).unwrap();
19//!
20//! // Serialize back to XML
21//! // let xml = ser::to_string(&hdr).unwrap();
22//! ```
23
24pub mod de;
25pub mod envelope;
26pub mod error;
27pub mod ser;
28
29pub use error::ParseError;