ElixirXML.Namespace (ElixirXML v0.0.1)
View SourceA module for handling XML namespaces, including extracting and reversing XML namespace mappings.
This module provides:
Summary
Functions
Extracts namespaces from XML elements and normalizes them.
Reverses namespace extraction, restoring prefixed XML names.
Functions
@spec extract(binary(), map()) :: binary()
@spec extract(list(), map()) :: list()
@spec extract(map(), map()) :: map()
Extracts namespaces from XML elements and normalizes them.
Examples
iex> ElixirXML.Namespace.extract(%{name: "ns:tag", attributes: [{"xmlns:ns", "http://example.com"}], children: []})
%{name: "tag", ns: "http://example.com", attributes: [], children: []}
Reverses namespace extraction, restoring prefixed XML names.
Examples
iex> ElixirXML.Namespace.reverse(%{name: "tag", ns: "http://example.com", attributes: [], children: []})
%{name: "ns:tag", attributes: [{"xmlns:ns", "http://example.com"}], children: []}