Expand description
§kobold-xml
A clean-room, Rust-native COBOL-data XML layer. It turns a decoded COBOL record (a tree of named fields with values) into deterministic XML, and is independent of GnuCOBOL/libcob – it links no COBOL runtime and reproduces no runtime’s exact bytes.
Not a GnuCOBOL parity claim. This is a forward-looking interchange layer: what a safe Rust-native COBOL XML layer should do, not what GnuCOBOL 3.2 does. Its evidence is the
EXT.XML.*court namespace.
§v0.1 – XML GENERATE
use kobold_xml::{CobolField, record_to_xml, generate, GenerateOptions};
let rec = CobolField::group("ACCOUNT", vec![
CobolField::alnum("NAME", &b"JANE "[..]),
CobolField::numeric("BALANCE", &b"104277"[..], 2, false), // 1042.77
]);
let xml = generate(&record_to_xml(&rec), &GenerateOptions::default());
assert_eq!(xml, "<ACCOUNT><NAME>JANE</NAME><BALANCE>1042.77</BALANCE></ACCOUNT>");- [
generate] serializes an explicitXmlElementtree to deterministic XML (EXT.XML.GENERATE.1), with explicit text/attribute escaping (EXT.XML.ESCAPE.1). record_to_xmlmaps aCobolFieldrecord tree to that XML tree (FILLERomitted; v0.1 value policy documented on thecobolmodule).
§v0.2 (planned) – XML PARSE
A real event stream + generate->parse round-trip (EXT.XML.PARSE.1 / EXT.XML.ROUNDTRIP.1).
Re-exports§
pub use cobol::record_to_xml;pub use cobol::sanitize_name;pub use cobol::CobolField;pub use cobol::CobolValue;pub use generate::escape_attr;pub use generate::escape_text;pub use generate::generate;pub use generate::GenerateOptions;pub use generate::XmlElement;pub use generate::XmlNode;
Modules§
- cobol
- A clean-room COBOL-record data model and its XML rendering. This is independent of GnuCOBOL/libcob
– it is a plain Rust description of a record (a tree of named fields with decoded values) and a
deterministic mapping to the [
crate::generate] XML element tree. The caller decodes their COBOL data intoCobolFields by whatever means they like;kobold-xmldoes not link any COBOL runtime. - generate
- XML GENERATE – a deterministic serializer of an explicit element tree to XML text.
Constants§
- COURT_
NAMESPACE - The extension court namespace – never
GNURUST.*. So a reader can never mistake this crate’s evidence for a GnuCOBOL parity claim.