gzah
Is it possible to convert Abstract Syntax Tree into XML code in Elixir
Is it possible to convert Abstract Syntax Tree into XML code in Elixir
Most Liked
lucaong
The point is that there is no “normal” XML. You could give an example snippet of how the XML could look like. Choosing which fields you want to expose and how to represent the AST in XML is 100% up to you.
Library wise, one of the packages posted by @kokolegorille will probably work to serialize Elixir data structures into XML, but they will require some serialization logic on your side.
NobbZ
So "<?xml foo><ast>#{File.read("foo.ex") |> elem(1)}</ast>" is fine for you?
Follows your “specification” of “should be XML and contain the info if there was a defmodule etc”.
NobbZ
Thats a string that uses interpolation to insert a given files sourcecode into the string. As its wrapped in tags, its close enough to XML.
You might need to escape, as I realise now…
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









