Skip to main content

Module xml

Module xml 

Source
Expand description

Native xml module for XML parsing and serialization.

Exports: xml.parse(text), xml.stringify(value)

XML nodes are represented as Shape TypedObjects with the XmlNode schema: { name: string, attributes: HashMap<string, string>, children: Array<XmlNode>, text: string }

W17-out-of-bundle-A-followups (2026-05-12): children rewire per the C+ precedent recorded in phase-2d-playbook.md §3 (“Bundle-A checkpoint-2 amendment”). Pre-rewire, each child was an Arc<HeapValue::HashMap> carried inside the deleted TypedArrayData::HeapValue arm. Post-rewire, each child is an Arc<HeapValue::TypedObject> with the registered XmlNode schema, and the outer children array lowers to TypedArrayData::TypedObject per ADR-006 §2.7.24 Q25.A’s specialized list.

User-visible API: node.children[i].name / .attributes / .text continue to work via TypedObject field access (same shape as the prior HashMap dispatch). The text field is now always present (empty string when absent); the prior optional-field shape was already flattened.

Stage C HashMap-marshal P1(b) historical context (2026-05-07):

  • xml.parse returns the root element as TypedReturn::OkObjectPairs per Cluster #4 β shape (mirrors arrow.metadata / http.rs precedents).
  • xml.stringify takes value: HashMap<string, *> typed input via Vec<(Arc<String>, Arc<HeapValue>)> FromSlot from Step 1 P1(b) infrastructure (commit 36519f6). Walks the recursive HeapValue tree using direct pattern matching — no marshal-boundary re-entry per element. The reader now dispatches the children field through TypedArrayData::TypedObject per the post-rewire construction shape.
  • Attributes (HashMap<string, string>) carried via ConcreteReturn::HashMapStringString on output and read directly from HeapValue::HashMap(d) on input.

Tests deleted along with the legacy ValueWord-based fixtures, mirroring the csv_module migration (commit 9f6b1d3). New typed-marshal test harness arrives with the shape-vm cleanup workstream.

Functions§

create_xml_module
Create the xml module with XML parsing and serialization functions.