simple_xml_parser v0.0.1 SimpleXmlParser.Utils.TreeParser
The module converts PureXmlParser result to Elixir data types
Link to this section Summary
Functions
Convert the input list from PureXmlParser to a map
Link to this section Functions
Convert the input list from PureXmlParser to a map
Examples
Parse an empty object
iex> SimpleXmlParser.Utils.TreeParser.to_map({:return, [], []})
%{return: nil}
Parse a primitive:
iex> SimpleXmlParser.Utils.TreeParser.to_map({:return, "Hello world", []})
%{return: "Hello world"}
Parse a single object
iex> SimpleXmlParser.Utils.TreeParser.to_map({:return, [{:id, "1", []}, {:code, "example", []}], []})
%{return: %{id: "1", code: "example"}}
Parse a complex object
iex> SimpleXmlParser.Utils.TreeParser.to_map({:return, [{:childs, [{:child, "1", []}], []}], []})
%{return: %{childs: %{child: "1"}}}
iex> SimpleXmlParser.Utils.TreeParser.to_map({:return, [{:childs, [{:child, "1", []}, {:child, "2", []}], []}], []})
%{return: %{childs: %{child: ["1", "2"]}}}