# XML Builder (Elixir)

> Generate XML in Elixir from tuples and builder functions

Source: https://talira.ai/catalog/xml-builder-elixir-6kn7ps42
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / parsing / xml](https://talira.ai/categories/developer-tools/parsing/xml), [languages / elixir](https://talira.ai/categories/languages/elixir)
- Platforms: linux, macos, windows[^2]
- Licence: MIT[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [Joshua Nussbaum](https://talira.ai/orgs/joshua-nussbaum.md)

XML Builder is an Elixir library for generating XML, inspired by Jim Weirich's builder library for Ruby. Each node is a tuple of a name, an attributes map and its content or child list, built by hand or with helper functions such as document and element, and generate turns the tree into an XML string. It handles namespaces, DOCTYPE declarations, the declared encoding, standalone documents and pretty or compact formatting. Content is escaped by default, with CDATA, already-safe and raw iodata content as explicit opt-outs, and generate_iodata skips building a single binary for large documents such as sitemaps.

## Links

- GitHub: https://github.com/joshnuss/xml_builder
- Docs: https://hexdocs.pm/xml_builder/

## Problems it solves

- generate an XML document such as a sitemap or feed from an Elixir app
- build XML for a SOAP or partner API request in Elixir without string templates
- make sure the XML my Elixir code writes is properly escaped

## Features

- XML nodes as {name, attributes, content} tuples or document/element helper calls
- Escapes content by default, with CDATA, safe and raw iodata opt-outs
- Namespaces, DOCTYPE declarations, encoding and standalone declarations
- Pretty-printed or compact output
- generate_iodata for large documents without one big binary

## Trust

Overall: 0.36 out of 1.
Signals: maintenance 0.45, adoption 0.45, momentum 0.11, community 0.58, backing 0.30, extensibility 0.00.

- last commit 3 months ago
- 187 GitHub stars
- 27 contributors
- backed by Joshua Nussbaum

## Alternatives

- [SweetXml](https://talira.ai/catalog/sweetxml-wcrr3x8m.md): Query XML in Elixir with XPath sigils
- [Saxy](https://talira.ai/catalog/saxy-5q4re2nw.md): Fast streaming XML SAX parser and encoder for Elixir
- [Erlsom](https://talira.ai/catalog/erlsom-00ksk4wn.md): XML parser for Erlang: SAX parsing and XML Schema based data binding

## Sources

[^1]: https://github.com/joshnuss/xml_builder/blob/master/LICENSE (checked 28 Nov 2026)
[^2]: https://github.com/joshnuss/xml_builder/blob/master/README.md (checked 28 Nov 2026)
