Open prodis opened 5 years ago
iex(9)> {:root, nil, [one: 1, two: "2", none: ""]} |> XmlBuilder.generate
** (FunctionClauseError) no function clause matching in XmlBuilder.format/3
The following arguments were given to XmlBuilder.format/3:
# 1
{:one, 1}
# 2
1
# 3
[]
Attempted function clauses (showing 10 out of 12):
defp format(:xml_decl, 0, options)
defp format({:doctype, {:system, name, system}}, 0, _options)
defp format({:doctype, {:public, name, public, system}}, 0, _options)
defp format(string, level, options) when is_bitstring(string)
defp format(list, level, options) when is_list(list)
defp format({nil, nil, name}, level, options) when is_bitstring(name)
defp format({name, attrs, content}, level, options) when (attrs == nil or is_map(attrs) and map_size(attrs) == 0 or (attrs == nil or is_list(attrs) and length(attrs) == 0)) and (content == nil or is_list(content) and length(content) == 0)
defp format({name, attrs, content}, level, options) when content == nil or is_list(content) and length(content) == 0
defp format({name, attrs, content}, level, options) when (attrs == nil or is_map(attrs) and map_size(attrs) == 0 or (attrs == nil or is_list(attrs) and length(attrs) == 0)) and not(is_list(content))
defp format({name, attrs, content}, level, options) when (attrs == nil or is_map(attrs) and map_size(attrs) == 0 or (attrs == nil or is_list(attrs) and length(attrs) == 0)) and is_list(content)
(xml_builder) lib/xml_builder.ex:220: XmlBuilder.format/3
(elixir) lib/enum.ex:1386: anonymous fn/4 in Enum.map_join/3
(elixir) lib/enum.ex:1925: Enum."-map_join/3-lists^foldl/2-0-"/3
(elixir) lib/enum.ex:1925: Enum.map_join/3
(xml_builder) lib/xml_builder.ex:285: XmlBuilder.format_content/3
(xml_builder) lib/xml_builder.ex:253: XmlBuilder.format/3
(xml_builder) lib/xml_builder.ex:218: XmlBuilder.generate/2
iex(9)> {:root, nil, [one: 1, two: "2", none: ""]} |> XmlBuilder.element
{:root, nil, [{:one, nil, 1}, {:two, nil, "2"}, {:none, nil, ""}]}
iex(10)> {:root, nil, [one: 1, two: "2", none: ""]} |> XmlBuilder.element |> XmlBuilder.generate
"<root>\n <one>1</one>\n <two>2</two>\n <none></none>\n</root>"
iex(11)>
https://hexdocs.pm/elixir/Map.html#to_list/1