Module: Lutaml::Xml::Adapter::XmlSerialization
- Defined in:
- lib/lutaml/xml/adapter/xml_serialization.rb
Overview
Shared XML serialization logic for all adapters
This module provides the common three-phase XML serialization architecture:
-
Collect namespace needs from XmlElement tree
-
Plan namespace declarations with hoisting
-
Render using parallel traversal (XmlElement + DeclarationPlan)
All adapters follow the same pattern:
-
Case A: Parsed element (adapter-specific) → build_xml
-
Case B: XmlElement → build_xml_element_with_plan
-
Case C: Model instance → transform to XmlElement OR legacy path
Instance Method Summary collapse
-
#to_xml(options = {}) ⇒ String
Serialize to XML using three-phase architecture.
Instance Method Details
#to_xml(options = {}) ⇒ String
Serialize to XML using three-phase architecture
37 38 39 40 41 42 43 |
# File 'lib/lutaml/xml/adapter/xml_serialization.rb', line 37 def to_xml( = {}) # Accept xml_declaration from options if present (for model serialization) @xml_declaration = [:xml_declaration] if [:xml_declaration] # Build XML using adapter-specific builder build_xml_document() end |