LibOss.Xml (lib_oss v0.3.0)

View Source

Unified XML processing module for LibOss.

This module provides a consistent interface for XML parsing operations, abstracting the underlying XML parsing library implementation.

Summary

Functions

Converts XML string to a map structure, compatible with XmlToMap.naive_map/1.

Functions

naive_map(xml)

@spec naive_map(String.t()) :: map()

Converts XML string to a map structure, compatible with XmlToMap.naive_map/1.

This function parses XML and converts it to a nested map structure that matches the output format expected by the rest of the LibOss codebase.

Examples

iex> xml = "<root><item>value</item></root>"
iex> LibOss.Xml.naive_map(xml)
%{"root" => %{"item" => "value"}}

iex> xml = "<root><items><item>1</item><item>2</item></items></root>"
iex> LibOss.Xml.naive_map(xml)
%{"root" => %{"items" => %{"item" => ["1", "2"]}}}

Parameters

  • xml - XML string to parse

Returns

  • map - Parsed XML as nested map structure

Raises

  • SweetXml.XmlParseError - When XML parsing fails