Skip to content

Instantly share code, notes, and snippets.

@garyposter
Created December 9, 2015 11:36
Show Gist options
  • Save garyposter/6ea97be64e824cbc98a0 to your computer and use it in GitHub Desktop.
Save garyposter/6ea97be64e824cbc98a0 to your computer and use it in GitHub Desktop.
body
|> xpath(~x"//current_observation/*"l, # Get a list of the child nodes.
tag: ~x"name()", # Get the tag name for each.
value: ~x"./text()"s) # Get the text for each.
|> Enum.map(fn(%{tag: tag, value: value}) -> {List.to_atom(tag), value} end)
|> Enum.into(Map.new)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment