I’ve been doing some work to try to make processing XML documents a
little easier and more intuitive. I’ve built the ability to transform
the xmerl
records produced by SweetXml
into Elixir Structs.
One benefit of doing this is that you can use dot-notation and (in
IEx) tab completion to reference sub-components of various objects.
For example, if you have an XML element in a variable element1
,
then you can use the following to reference its name (tag) and
children:
element1.name
element1.content
I’ve also implemented a small set of helper functions.
See the README for more info.
If you’d like to try it, you can find it here:
https://github.com/dkuhlman/xmlelixirstructs
You can include it in your mix
project by adding the following
dependency to your mix.exs
:
{:xmlelixirstructs, github: "dkuhlman/xmlelixirstructs"},
If you try it and have comments or suggestions, I’d like to hear
them.
Dave