We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[]
When encoding something like:
{:A, nil, [ [], {:B, nil, []} [], ]} |> XmlBuilder.generate()
the resulting XML contains unnecessary newlines:
<A> <B> </A>
This is due to map_intersperse adding newlines unconditionally.
map_intersperse
Note that [] comes in handy in case you want to encode some values conditionally, like:
{:A, nil, [ (if a, do: encode(a), else: []), ]}
A solution is to Enum.filter myself on the children list (removing empty arrays... possibly recursively), or to use formatter: :none.
Enum.filter
formatter: :none
I just wanted to bring this issue up as maybe there is a cleaner solution to that.
Also, handling nil in children lists would come in handy and allow code like that:
nil
{:A, nil, [ a && encode(a), ]}
The text was updated successfully, but these errors were encountered:
Thanks @mneumann,
Besides solving it outside the library, another 2 ways I can think of
Open to PRs
Sorry, something went wrong.
No branches or pull requests
When encoding something like:
the resulting XML contains unnecessary newlines:
This is due to
map_intersperse
adding newlines unconditionally.Note that
[]
comes in handy in case you want to encode some values conditionally, like:A solution is to
Enum.filter
myself on the children list (removing empty arrays... possibly recursively), or to useformatter: :none
.I just wanted to bring this issue up as maybe there is a cleaner solution to that.
Also, handling
nil
in children lists would come in handy and allow code like that:The text was updated successfully, but these errors were encountered: